Hi Vivek,

Thanks for the reply.

Yes I tried the same earlier itself. In that case problem is the input
string decode with one encoding format and when it encode into a byte
string using utf-8
the resulting string is not matching with the input string. Without
specifying the encoding format also, while writing to any file it will take
the default utf-8 encoding I think.

[root] python i18n_test.py
Étest
<?xml version="1.0" encoding="Latin-1"?>
<root>
 <output_string>
  Étest
 </output_string>
</root>

But the file content is as below.

<?xml version="1.0" encoding="utf-8"?><root><output_string>Ä
test</output_string></root>

Actually in the earlier part when we write to xml we got <c9> which was
correct when we look into the ISO-8859-1 (Latin-1) international character
set and hexadecimal.
But here we got the hexa <c4> instead. Again for another character which
can not be decoded using utf-8 it is giving the same value Ä which is
interesting :)


Apart from encoding what we have to take care in python coding to support
internationalization, any document can be suggested for that.

Thanks
Dileep







On Wed, Nov 27, 2013 at 5:57 PM, Vivek Puri <vpuri.soc...@gmail.com> wrote:

> Hi,
>
>  How the internationalization works in Python 2.6.
>>
>
> Internationalization is different topic. Here you are dealing with
> character encoding.
>
>
> You are actually on right track except this line:
>
>       write_to_xml(input_string_unicode, encoding)
>>
>
> change it to
>
>       write_to_xml(input_string_unicode, 'utf-8')
>
> Basically once you have already converted the string to unicode
> you should just write the output as unicode and utf8 is generally
> more acceptable encoding.
>
> rgds
> vivek
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>



-- 
  Regards
  D.S. DIleep
 ♪♫ How you live one day is eventually how you live your life ♪♫
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to