Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16688

Re: How to generate java .properties files in python

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'check.': 0.07; 'backslash': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:files': 0.09; 'subject:java': 0.09; 'whitespaces': 0.09; 'subject:python': 0.10; 'exception': 0.12; 'encode': 0.16; 'keys.': 0.16; 'wrote:': 0.18; 'any,': 0.18; "haven't": 0.20; 'java': 0.21; "aren't": 0.21; 'header:In-Reply-To:1': 0.22; 'raise': 0.28; 'subject: .': 0.29; "skip:' 10": 0.29; 'skip:( 20': 0.31; "i'll": 0.31; 'header:User-Agent:1': 0.33; 'header:X -Complaints-To:1': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'subject:How': 0.35; 'uses': 0.36; '8bit%:86': 0.37; 'but': 0.37; 'think': 0.37; 'received:org': 0.38; 'some': 0.38; 'characters': 0.39; 'to:addr:python.org': 0.40; '2011': 0.61; 'skip:\xd0 20': 0.77; 'fortunately': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Serhiy Storchaka <storchaka@gmail.com>
Subject Re: How to generate java .properties files in python
Date Mon, 05 Dec 2011 23:46:42 +0200
References <CAJ6cK1aLyX0QSA3K3b+Rc+BPi9xZvbYJaEFk3-ijhdQWcdi9_w@mail.gmail.com> <jbj86t$r9e$1@dough.gmane.org> <CAJ6cK1Zfi5juLcKW-_PJ_Bhh6ag7AMRyqsH-qfnzhhETScQydQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host 79.124.185.186
User-Agent Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111110 Thunderbird/8.0
In-Reply-To <CAJ6cK1Zfi5juLcKW-_PJ_Bhh6ag7AMRyqsH-qfnzhhETScQydQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3322.1323121632.27778.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323121632 news.xs4all.nl 6936 [2001:888:2000:d::a6]:60056
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:16688

Show key headers only | View raw


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


Thread

Re: How to generate java .properties files in python Serhiy Storchaka <storchaka@gmail.com> - 2011-12-05 23:46 +0200

csiph-web