Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 12:05:34 +1100, Chris Angelico wrote: > Latin-1 is not "arbitrary bytes". It is a very specific encoding that > cannot decode every possible byte value. Yes it can. py> blob = bytes(range(256)) py> len(blob) 256 py> blob[45:55] b'-./0123456' py> s = blob.decode('latin1') py>

PyQt4 QWebView cant load google maps markers

2018-03-22 Thread Xristos Xristoou
I want to create a simple python app using pyqt,QWebView and google maps with markers. The problem is that,the markers does not load inside the QWebView, as you can see they load just fine in the browser. here the simple code : import sys from PyQt4.QtCore import * from PyQt4.QtGui i

Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:39 AM, Steven D'Aprano wrote: > On Fri, 23 Mar 2018 11:08:56 +1100, Chris Angelico wrote: >> Okay. Give me a good reason for the database itself to be locked to >> Latin-1. Make sure you explain how potentially saving the occasional >> byte of storage (compared to UTF-8)

Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 11:08:56 +1100, Chris Angelico wrote: > On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano > wrote: >> On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote: >> I was reading though, that JSON files must be encoded with UTF-8. So should I be doing string.decode('l

Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:39 AM, Ben Finney wrote: > Chris Angelico writes: > >> There is NOT always a good reason for a suboptimal configuration. > > True. Did anyone claim otherwise? > > What I saw Steven responding to was your claim that there is *never* a > good reason to do it. > > To refut

Re: Putting Unicode characters in JSON

2018-03-22 Thread Thomas Jollans
On 22/03/18 20:46, Tobiah wrote: > I was reading though, that JSON files must be encoded with UTF-8.  So > should I be doing string.decode('latin-1').encode('utf-8')?  Or does > the json module do that for me when I give it a unicode object? Definitely not. In fact, that won't even work. >>> impo

Re: Putting Unicode characters in JSON

2018-03-22 Thread Ben Finney
Chris Angelico writes: > There is NOT always a good reason for a suboptimal configuration. True. Did anyone claim otherwise? What I saw Steven responding to was your claim that there is *never* a good reason to do it. To refute that, it's sufficient to show that good reason can exist in some c

Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 11:25 AM, Ben Finney wrote: > Chris Angelico writes: > >> On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano >> wrote: >> > On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote: >> >> Reconfigure your MySQL database to use UTF-8. There is no reason to >> >> use Latin-1

Re: Putting Unicode characters in JSON

2018-03-22 Thread Ben Finney
Chris Angelico writes: > On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano > wrote: > > On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote: > >> Reconfigure your MySQL database to use UTF-8. There is no reason to > >> use Latin-1 in the database. > > > > You don't know that. You don't know

Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 10:47 AM, Steven D'Aprano wrote: > On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote: > >>> I was reading though, that JSON files must be encoded with UTF-8. So >>> should I be doing string.decode('latin-1').encode('utf-8')? Or does >>> the json module do that for

Re: Putting Unicode characters in JSON

2018-03-22 Thread Steven D'Aprano
On Fri, 23 Mar 2018 07:09:50 +1100, Chris Angelico wrote: >> I was reading though, that JSON files must be encoded with UTF-8. So >> should I be doing string.decode('latin-1').encode('utf-8')? Or does >> the json module do that for me when I give it a unicode object? > > Reconfigure your MySQL

PyQt4 QWebView cant load google maps markers

2018-03-22 Thread Xristos Xristoou
I want to create a simple python app using pyqt,QWebView and google maps with markers. The problem is that,the markers does not load inside the QWebView, as you can see they load just fine in the browser. here the simple code : import sys from PyQt4.QtCore import * from PyQt4.QtGui impo

Re: Putting Unicode characters in JSON

2018-03-22 Thread Tobiah
On 03/22/2018 01:09 PM, Chris Angelico wrote: On Fri, Mar 23, 2018 at 6:46 AM, Tobiah wrote: I have some mailing information in a Mysql database that has characters from various other countries. The table says that it's using latin-1 encoding. I want to send this data out as JSON. So I'm jus

Re: Putting Unicode characters in JSON

2018-03-22 Thread Chris Angelico
On Fri, Mar 23, 2018 at 6:46 AM, Tobiah wrote: > I have some mailing information in a Mysql database that has > characters from various other countries. The table says that > it's using latin-1 encoding. I want to send this data out > as JSON. > > So I'm just taking each datum and doing 'name'.d

Putting Unicode characters in JSON

2018-03-22 Thread Tobiah
I have some mailing information in a Mysql database that has characters from various other countries. The table says that it's using latin-1 encoding. I want to send this data out as JSON. So I'm just taking each datum and doing 'name'.decode('latin-1') and adding the resulting Unicode value ri

Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Thomas Jollans
On 2018-03-22 19:37, Damjan Stojanovski wrote: > i am sorry but i can not find a way to attach an image here so you can see > what i mean. Please someone tell me how to add an image here. > This is a text only list. -- https://mail.python.org/mailman/listinfo/python-list

Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Terry Reedy
On 3/22/2018 2:37 PM, Damjan Stojanovski wrote: i am sorry but i can not find a way to attach an image here so you can see what i mean. Please someone tell me how to add an image here. You cannot and there is no need. List is text only, no attachments. Reduce code to the minimum needed to ge

Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Larry Martell
On Thu, Mar 22, 2018 at 2:37 PM, Damjan Stojanovski wrote: > i am sorry but i can not find a way to attach an image here so you can see > what i mean. Please someone tell me how to add an image here. You can't. Copy/paste the error. And please include the post you are replying to. -- https://ma

Re: I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Damjan Stojanovski
i am sorry but i can not find a way to attach an image here so you can see what i mean. Please someone tell me how to add an image here. Thanks Dan -- https://mail.python.org/mailman/listinfo/python-list

I keep getting this error message when i try to run a program in Python

2018-03-22 Thread Damjan Stojanovski
Dear all I am totally new in learning Python and i am learning from a beginner's book called automate the boring stuff with Python and i downloaded the Python 64 bit version for Windows and i started writing some examples from the book. At the end whenever i try to run the program i keep gettin