Re: convert unicode characters to visibly similar ascii characters

2008-07-02 Thread Jim
On Jul 1, 8:42 pm, Jim <[EMAIL PROTECTED]> wrote: > On Jul 1, 8:29 pm, John Machin <[EMAIL PROTECTED]> wrote: > > Comments on the above grep output: > > 1. You have SOFT HYPHEN twice, mapping it to u'-' and '-' > > Hmph. I'll correct that. Thanks. Well, maybe not. I forgot that I got the by-hand

Re: convert unicode characters to visibly similar ascii characters

2008-07-02 Thread Peter Bulychev
Thank you. That is exactly what I was looking for. 2008/7/2 Jim <[EMAIL PROTECTED]>: > Peter Bulychev wrote: > > I want to convert unicode character into ascii one. > You have to make some arbitrary choices of what to translate. Based > on some materials on effbot's site, and a recipe, I made

Re: convert unicode characters to visibly similar ascii characters

2008-07-02 Thread M.-A. Lemburg
On 2008-07-01 20:31, Peter Bulychev wrote: Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Ben Finney
Jim <[EMAIL PROTECTED]> writes: > I don't like the spacing in [PEP 8], personally. Nevertheless, your Python code will be much less effort to read by others (and yourself in future) if it is written in conformance with PEP 8. Writing all your Python code to conform with that standard is the simp

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Jim
On Jul 1, 8:29 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 2, 9:55 am, Jim <[EMAIL PROTECTED]> wrote: > > Comments on the above grep output: > 1. You have SOFT HYPHEN twice, mapping it to u'-' and '-' Hmph. I'll correct that. Thanks. > 2. The idea of a soft hyphen is as a hint to a hyphena

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Jim
On Jul 1, 8:29 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 2, 9:55 am, Jim <[EMAIL PROTECTED]> wrote: > > Comments on the above grep output: > 1. You have SOFT HYPHEN twice, mapping it to u'-' and '-' Hmph. I'll correct that. Thanks. > 2. The idea of a soft hyphen is as a hint to a hyphena

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread John Machin
On Jul 2, 9:55 am, Jim <[EMAIL PROTECTED]> wrote: > Peter Bulychev wrote: > > I want to convert unicode character into ascii one. > > You have to make some arbitrary choices of what to translate. Based > on some materials on effbot's site, and a recipe, I made > ftp://alan.smcvt.edu/hefferon/uni

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Jim
Peter Bulychev wrote: > I want to convert unicode character into ascii one. You have to make some arbitrary choices of what to translate. Based on some materials on effbot's site, and a recipe, I made ftp://alan.smcvt.edu/hefferon/unicode2ascii.py which has at least some of what you are looking

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Jim
Peter Bulychev wrote: > I want to convert unicode character into ascii one. You have to make some arbitrary choices of what to translate. Based on some materials on effbot's site, and a recipe, I made ftp://alan.smcvt.edu/hefferon/unicode2ascii.py which has at least some of what you are looking

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Terry Reedy
Peter Bulychev wrote: Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Laszlo Nagy
Peter Bulychev wrote: Thank you for you answer. If you only want this to work for a subset, please define that subset. Actually, I want to convert only punctuations (dots, commas, hyphens and so on). Then make your translation table manually and apply this method: unicode.translate Fina

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Peter Bulychev
Thank you for you answer. If you only want this to work for a subset, please define that subset. Actually, I want to convert only punctuations (dots, commas, hyphens and so on). -- Best regards, Peter Bulychev. -- http://mail.python.org/mailman/listinfo/python-list

Re: convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Laszlo Nagy
Peter Bulychev wrote: Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly si

convert unicode characters to visibly similar ascii characters

2008-07-01 Thread Peter Bulychev
Hello. I want to convert unicode character into ascii one. The method ".encode('ASCII') " can convert only those unicode characters, which fit into 0..128 range. But there are still lots of characters beyond this range, which can be manually converted to some visibly similar ascii characters. For