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: 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 Subject: Re: How to generate java .properties files in python Date: Mon, 05 Dec 2011 23:46:42 +0200 References: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 05.12.11 22:25, Arnaud Delobelle написав(ла): > On 5 December 2011 20:05, Serhiy Storchaka 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))