Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #10935
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <chris@rebertia.com> |
| 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; 'advice.': 0.05; 'distinct': 0.05; 'ascii': 0.07; 'below).': 0.07; 'server:': 0.07; 'python': 0.08; '"default': 0.09; '>>>>': 0.09; 'locale': 0.09; 'machines.': 0.09; 'received:209.85.160.174': 0.09; 'received :mail-gy0-f174.google.com': 0.09; 'x86_64': 0.09; 'am,': 0.12; '2.5.2': 0.16; '[gcc': 0.16; 'boils': 0.16; 'linux2': 0.16; 'osx': 0.16; 'subject: ...': 0.16; 'uname': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'linux': 0.17; 'advance': 0.18; 'cheers,': 0.18; 'specifies': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'seems': 0.20; 'subject:Question': 0.21; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'server.': 0.24; 'aug': 0.24; 'statement': 0.25; 'guess': 0.26; 'function': 0.27; 'subject:need': 0.28; 'problem': 0.28; 'server': 0.29; 'consistently': 0.29; 'message-id:@mail.gmail.com': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.30; "skip:' 10": 0.30; 'chris': 0.32; 'hi,': 0.32; 'does': 0.32; "can't": 0.33; '...': 0.34; 'deploy': 0.34; 'wright': 0.34; 'received:209.85.160': 0.35; 'problem.': 0.36; 'fri,': 0.36; 'pst': 0.37; 'using': 0.37; 'run': 0.37; 'but': 0.37; 'two': 0.37; 'could': 0.38; 'think': 0.38; 'some': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'correctly': 0.39; 'e.g.': 0.39; 'relatively': 0.39; 'represent': 0.39; 'provided': 0.60; 'your': 0.61; 'here': 0.65; 'details': 0.65; 'here.': 0.66; 'show': 0.67; 'encoding,': 0.84; 'encoding?': 0.84; 'mac.': 0.84; 'mark)': 0.84; 'sender:addr:chris': 0.84; 'specifics': 0.84; 'url:rebertia': 0.84; 'jul': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=yHiO6jN5YBvqJZfY7I+eAWNpMeqdUr5se151DoXGa6U=; b=RuUBP+W50s5CkzZE+G3TOmyXJZ5xExHmAVfmcnXXZTmEnFzT8Jz+xynlVX+4bKDR3h 2N5p5rvVjYe22hfKQcd46smf2Y2keinMuNggagcX3yQAyv03bqAkXe9WFFvf2wfcJ+H2 7kyQPabtSD1vlEWn8k86zbBzjPQFT8/JOFMR4= |
| MIME-Version | 1.0 |
| Sender | chris@rebertia.com |
| In-Reply-To | <78D1ED51-FAF5-47FA-BFD2-6A083A2E7351@gmail.com> |
| References | <78D1ED51-FAF5-47FA-BFD2-6A083A2E7351@gmail.com> |
| Date | Fri, 5 Aug 2011 14:12:40 -0700 |
| X-Google-Sender-Auth | Yjtr2H72EvXTMPyeGOh8OTSBWxU |
| Subject | Re: Question about encoding, I need a clue ... |
| From | Chris Rebert <clp2@rebertia.com> |
| To | Geoff Wright <geoffwright240@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| 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.1948.1312579221.1164.python-list@python.org> (permalink) |
| Lines | 69 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1312579221 news.xs4all.nl 23966 [2001:888:2000:d::a6]:50196 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:10935 |
Show key headers only | View raw
On Fri, Aug 5, 2011 at 11:07 AM, Geoff Wright <geoffwright240@gmail.com> wrote: > Hi, > > I use Mac OSX for development but deploy on a Linux server. (Platform details provided below). > > When the locale is set to FR_CA, I am not able to display a u circumflex consistently across the two machines even though the default encoding is set to "ascii" on both machines. ASCII can't represent a circumflex anyway, and I think the "default encoding" is distinct from the locale-set encoding, so I don't think the default encoding matters here. > Specifically, calendar.month_name[8] returns a ? (question mark) on the Linux server whereas it displays properly on the Mac OSX system. However, if I take the result from calendar.month_name[8] and run it through the following function .... unicode(calendar.month_name[8],"latin1") ... then the u circumflex displays correctly on the Linux server but does not display correctly on my Mac. > > Of course, I could work around this problem with a relatively simple if statement but these issues are going to show up all over my application so even a simple if statement will start to get cumbersome. > > I guess what it boils down to is that I would like to get a better handle on what is going on so that I will know how best to work through future encoding issues. Thanks in advance for any advice. > > Here are the specifics of my problem. > > On my Mac: > > Python 2.6.7 (r267:88850, Jul 30 2011, 23:46:53) > [GCC 4.2.1 (Apple Inc. build 5664)] on darwin <snip> >>>> calendar.month_name[8] > 'ao\xc3\xbbt' >>>> print calendar.month_name[8] > août >>>> print unicode(calendar.month_name[8],"latin1") > août > > On the linux server: > > uname -a > Linux alhena 2.6.32.8-grsec-2.1.14-modsign-xeon-64 #2 SMP Sat Mar 13 00:42:43 PST 2010 x86_64 GNU/Linux > > Python 2.5.2 (r252:60911, Jan 24 2010, 17:44:40) > [GCC 4.3.2] on linux2 <snip> >>>> calendar.month_name[8] > 'ao\xfbt' >>>> print calendar.month_name[8] > ao?t >>>> print unicode(calendar.month_name[8],"latin1") > août Some quick experimentation seems to indicate that your month names are Latin-1-encoded on Linux and UTF-8-encoded on Mac. Perhaps try using a locale that specifies a specific encoding? e.g. fr_CA.UTF-8 Cheers, Chris -- http://rebertia.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question about encoding, I need a clue ... Chris Rebert <clp2@rebertia.com> - 2011-08-05 14:12 -0700
csiph-web