Message28764
I intend to create some source code in UTF16. I start
the file with the encoding declaration line:
----------------------------------------------
# -*- coding: UTF-16LE -*-
print "Hello world"
----------------------------------------------
Unfortunately Python does not decode it in UTF16 as
expected. I have found some language in PEP 0263 that
says "It does not include encodings which use two or
more bytes for all characters like e.g. UTF-16." While
I am disappointed. I accepted this limitation is
necessary to make keep the parser simple. So my first
complaint is this fact should be documented in
http://www.python.org/doc/ref/encodings.html
Then I tried to save the source code with BOM. I think
there should be no excuse not to decode it in UTF16 in
that case. Unfortunately Python does not support this
either.
Indeed the only way to get it work is to write the
encoding declaration line in ASCII and the rest of the
file in UTF16 (see u16_hybrid.py). Obviously most text
editor would not support this.
I come up with this because Microsoft adopt UTF16 in
various places.
|
|
Date |
User |
Action |
Args |
2007-08-23 14:40:29 | admin | link | issue1503789 messages |
2007-08-23 14:40:29 | admin | create | |
|