On 04/02/12 01:34, C Anthony Risinger wrote:
> On Fri, Feb 3, 2012 at 4:39 PM, Stef Mientki<[email protected]>  wrote:
>    
>> On 03-02-2012 19:45, Phil Charlesworth wrote:
>>      
>>> I have posted Issue 681 about this problem:
>>>
>>> http://code.google.com/p/pyjamas/issues/detail?id=681
>>>
>>> Please see the issue for details.
>>>        
>> Somewhat releated problem,
>> diacritic characters are ok in PYJS, but wrong in PYJD ((IE).
>>
>> I had the same effect in some other situation,
>> and found by making a type,
>> that IE handles the character encoding wrong.
>>
>> The correct way to specify encoding in the web is:
>> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
>> which doesn't work correctly in IE
>>
>> by making the following type
>> <meta http-equiv="content-type" content="text/html;" charset=UTF-8>
>> the encoding works in Mozilla, Chrome and IE
>>      
> html5 boilerplate:
>
> https://github.com/h5bp/html5-boilerplate/blob/master/index.html
>
> ... uses:
>
> <meta charset="utf-8">
>
> ... and i read in other h5bp discussions that IE needs that statement
> within the first 512 bytes.
>
> per:
>
> http://www.w3schools.com/html5/att_meta_charset.asp
>
> ... and elsewhere, the `charset` attribute is proper html5-way of
> doing it, and should be used moving forward -- the http-equiv-ness is
> legacy.  i'd opt for the html5, since that's in front of us (and
> probably the reason IE works in that case).
>
> this is one of at least 5-10 items we should blatantly copy from the
> h5bp template.
>
>    
I don't think this is anything to do with what encoding the browser is 
using - it's to do with the fact that Python is using the ascii codec by 
default and there isn't an easy way to change that.
I found lots of stuff on the internet about the problem and the link 
below struck me as particularly apposite.

  http://blog.webforefront.com/archives/2011/02/python_ascii_co.html

I have
# -*- coding: utf-8 -*-
at the head of the python module, so I can be sure what I'm getting in 
unicode but I stll need to circumvent the str() calls in setText() and 
getText(), which I am doing (as a workaround) by
         content = getattr(self.txa.getElement(),'value')   #for getText()
         DOM.setAttribute(self.txa.getElement(), "value", content)   # 
for setText()
where self.txa is a TextArea widget

Reply via email to