RE: [Rest2web-develop] Encoding & Uservalues
Brought to you by:
mjfoord
From: Andrew I. <and...@us...> - 2006-04-06 06:48:34
|
I vote for 4) and then 1) as a fall-back, since you allow the developer to specify exactly what encoding they want. If they do not take advantage of that, just use the lowest-common denominator. Andrew > -----Original Message----- > From: res...@li... > [mailto:res...@li...]On Behalf Of > Fuzzyman > Sent: Wednesday, April 05, 2006 6:12 AM > To: Rest2web Dev List > Subject: [Rest2web-develop] Encoding & Uservalues > > > Hello all, > [snip] > > So how should rest2web handle uservalues passed in the config file and > at the command line ? > > First of all the config file. There are three options : > > 1) Ignore encodings and assume that the config file values are ascii or > in the appropriate encoding > 2) Decode to unicode immediately and restrict values to ascii only > 3) Guess the encoding of the config file, using the same technique as is > used for guessing the encoding of pages (annoying to implement but well > possible) > 4) Allow a magic value '__encoding__' to specify the encoding in use > > My personal preference is 4). I then need to choose between 1), 2) and > 3) as a fallback if that value is missing. > > I have a similar problem with values passed at the command line - > however in this case I can check ``sys.stdin.encoding``. This works (on > windows) even if stdin has already been closed. I will probably have to > force ascii only if that information isn't available. > > All the best, > > Fuzzyman > http://www.voidspace.org.uk/python/index.shtml |