Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16688
| From | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| Subject | Re: How to generate java .properties files in python |
| Date | 2011-12-05 23:46 +0200 |
| References | <CAJ6cK1aLyX0QSA3K3b+Rc+BPi9xZvbYJaEFk3-ijhdQWcdi9_w@mail.gmail.com> <jbj86t$r9e$1@dough.gmane.org> <CAJ6cK1Zfi5juLcKW-_PJ_Bhh6ag7AMRyqsH-qfnzhhETScQydQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3322.1323121632.27778.python-list@python.org> (permalink) |
05.12.11 22:25, Arnaud Delobelle написав(ла):
> On 5 December 2011 20:05, Serhiy Storchaka<storchaka@gmail.com> wrote:
>> You must also encode backslash ('\\'), whitespaces and control characters
>> (ord(c)<=32), '=' and ':' (key/value delimiters), '#' (comment) and '!'.
> Fortunately there aren't any of these in the keys.
"a=b" is same as "a= b".
>> And don't forget characters with code>0xFFFF.
> I haven't thought of these. I don't think that I have any, but I'll
> check. Do you know how they are encoded?
Java uses UTF-16.
if i>=0x110000:
raise some exception
if i>=0x10000:
return '\\u%04X\\u%04X' % (0xD800+((i-0x10000)>>10), 0xDC00+(i&0x3FF))
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: How to generate java .properties files in python Serhiy Storchaka <storchaka@gmail.com> - 2011-12-05 23:46 +0200
csiph-web