; many, many years!
If they're that short and people are depending on them, it won't be
too much work to port them. And you gain a huge measure of
reliability: you no longer have to worry about "Unicode filenames" -
or, to be more precise, "non-ASCII filenames" -
gt;>> that new file (it's a poor man's DB).
> >>>
> >>> Next, I can look up text in the file and open the saved filename.
> >>> Everything works great until I hit those darn unicode filenames.
>
> ...
>
> >> Do you get the error with
ename and puts into an emacs buffer, and then lets me add information
to
that new file (it's a poor man's DB).
Next, I can look up text in the file and open the saved filename.
Everything works great until I hit those darn unicode filenames.
...
Do you get the error with python 3?
I
> > filename and puts into an emacs buffer, and then lets me add information
> to
> > that new file (it's a poor man's DB).
> >
> > Next, I can look up text in the file and open the saved filename.
> > Everything works great until I hit those darn unicode
n to
> that new file (it's a poor man's DB).
>
> Next, I can look up text in the file and open the saved filename.
> Everything works great until I hit those darn unicode filenames.
Yes the names you download are unicode.
All OS can save that filename to disk these days.
Can
an's DB).
>
> Next, I can look up text in the file and open the saved filename.
> Everything works great until I hit those darn unicode filenames.
>
> Just to confuse me even more, the error seems to be coming from a bit of
> tkinter code:
> if sresults.has_key(textAt
r man's DB).
Next, I can look up text in the file and open the saved filename.
Everything works great until I hit those darn unicode filenames.
Just to confuse me even more, the error seems to be coming from a bit of
tkinter code:
if sresults.has_key(textAtCursor):
bookname = os.
r man's DB).
Next, I can look up text in the file and open the saved filename.
Everything works great until I hit those darn unicode filenames.
Just to confuse me even more, the error seems to be coming from a bit of
tkinter code:
if sresults.has_key(textAtCursor):
bookname = os.
e file and open the saved filename.
Everything works great until I hit those darn unicode filenames.
Just to confuse me even more, the error seems to be coming from a bit of
tkinter code:
if sresults.has_key(textAtCursor):
bookname = os.path.expanduser(sresults[textAtCursor].strip())
Cool! Thanks to both Iliya and Peter!
On May 6, 7:34 pm, Peter Otten <__pete...@web.de> wrote:
> coldpizza wrote:
> > Hello,
>
> > I need to convert accented unicode chars in some audio files to
> > similarly-looking ascii chars. Looks like the following code seems to
> > work on windows:
>
> > im
coldpizza wrote:
> Hello,
>
> I need to convert accented unicode chars in some audio files to
> similarly-looking ascii chars. Looks like the following code seems to
> work on windows:
>
> import os
> import sys
> import glob
>
> EXT = '*.*'
>
> lst_uni = glob.glob(unicode(EXT))
>
> os.system
Try smth like this:
import unicodedata
def remove_accents(str):
nkfd_form = unicodedata.normalize('NFKD', unicode(str))
return u''.join([c for c in nkfd_form if not unicodedata.combining(c)])
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I need to convert accented unicode chars in some audio files to
similarly-looking ascii chars. Looks like the following code seems to
work on windows:
import os
import sys
import glob
EXT = '*.*'
lst_uni = glob.glob(unicode(EXT))
os.system('chcp 437')
lst_asci = glob.glob(EXT)
print sys
Peter Bienstman schrieb:
> UnicodeEncodeError: 'ascii' codec can't encode characters in position 24-29:
> ordinal not in range(128)
>
> I could try encoding the string in utg-8, but then it wouldn't work under
> Windows.
>
> Is there an elegant cross-platform solution for this?
I assume you ar
Hi,
I'm trying to add support for unicode file names to my application.
I'm running into problems with e.g. the os.path.exists routine, which
complains if it gets passed a unicode string:
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/mnemosyne/pyqt_ui/main_dlg.py",
the xml.sax layer, really (ET also uses Expat, and
> doesn't seem to have any problems dealing with unicode filenames...)
That's because ET never invokes XML_SetBase. Without testing, this
suggests that there might be problem in ET with relative URIs
in parsed external entities. XML_Se
oesn't seem to have any problems dealing with unicode filenames...)
--
http://mail.python.org/mailman/listinfo/python-list
Edward K. Ream schrieb:
> Happily, the workaround is easy. Replace theFile with:
>
> # Use cStringIo to avoid a crash in sax when inputFileName has unicode
> characters.
> s = theFile.read()
> theFile = cStringIO.StringIO(s)
>
> My first attempt at a workaround was to use:
>
> s = theFile.read
Fredrik Lundh schrieb:
> Diez B. Roggisch wrote:
>
>> Filenames are expected to be bytestrings. So what happens is that the
>> unicode string you pass as filename gets implicitly converted using the
>> default encoding.
>
> it is ?
Yes. While you can pass Unicode strings as file names to many Py
Happily, the workaround is easy. Replace theFile with:
# Use cStringIo to avoid a crash in sax when inputFileName has unicode
characters.
s = theFile.read()
theFile = cStringIO.StringIO(s)
My first attempt at a workaround was to use:
s = theFile.read()
parser.parseString(s)
but the expat pars
Diez B. Roggisch wrote:
> Edward K. Ream wrote:
>
> > Hi. Presumably this is a easy question, but anyone who understands the
> > sax docs thinks completely differently than I do :-)
> >
> >
> >
> > Following the usual cookbook examples, my app parses an open file as
> > follows::
> >
> >
> >
> >
> Filenames are expected to be bytestrings.
The exception happens in a method to which no fileName is passed as an
argument.
parse_leo_file:
'C:\\prog\\tigris-cvs\\leo\\test\\unittest\\chinese?folder\\chinese?test.leo'
(trace of converted fileName)
Unexpected exception parsing
C:\prog\tigris
Diez B. Roggisch wrote:
> Filenames are expected to be bytestrings. So what happens is that the
> unicode string you pass as filename gets implicitly converted using the
> default encoding.
it is ?
>>> f = open(u"\u8116", "w")
>>> f.write("hello")
>>> f.close()
>>> f = open(u"\u8116", "r")
>>>
Edward K. Ream wrote:
> Hi. Presumably this is a easy question, but anyone who understands the
> sax docs thinks completely differently than I do :-)
>
>
>
> Following the usual cookbook examples, my app parses an open file as
> follows::
>
>
>
> parser = xml.sax.make_parser()
>
> parser.s
Hi. Presumably this is a easy question, but anyone who understands the sax
docs thinks completely differently than I do :-)
Following the usual cookbook examples, my app parses an open file as
follows::
parser = xml.sax.make_parser()
parser.setFeature(xml.sax.handler.feature_external_ges,
25 matches
Mail list logo