| View previous topic :: View next topic |
| Author |
Message |
Jackil
Joined: 24 May 2006 Posts: 97
|
| Hi guys. I got some problems with parsing a xml file while running a script on both linux and windows. Should I save the file as utf-8 on both platforms? |
| |
|
|
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
Jackil, what is the encoding of the xml file? what is giving you the option of saving as another encoding
And yes utf-8 should be OK as long as you read it back in as utf-8, and the xml parser accepts that |
| |
|
|
Jackil
Joined: 24 May 2006 Posts: 97
|
| BigDaddy, hmm.. the encoding is specified as utf-8, but the file is fetched from a webserver though. |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| How are you fetching it? |
| |
|
|
Jackil
Joined: 24 May 2006 Posts: 97
|
| I use urllib.urlopen |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| The result is a string, right? |
| |
|
|
Jackil
Joined: 24 May 2006 Posts: 97
|
Well, a filehandle
Which I then have created a small xml parser for |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| When reading it in, you might want to get it into unicode with stringjustread.decode('utf-8') |
| |
|
|
Jackil
Joined: 24 May 2006 Posts: 97
|
| Hmm.. interesting. |
| |
|
|
BigDaddy
Joined: 26 May 2006 Posts: 147
|
| To answer the original question, whatever worked on windows should work on linux, except that the system default encoding for 8-bit strings might be "windows-1252" and not "ascii" |
| |
|
|
| Page 1 of 3 |
Goto page 1, 2, 3 Next |
|