On Tue, Sep 27, 2016 at 03:46:25AM +0530, srinivas devaki wrote:
> How can I convert Unicode to Ascii by stripping of any non ascii characters.
>
> one way is to filter on s like
>
> ascii = ''.join(filter(lambda x: 0 <= ord(x) < 256, unicode_string))
>
> but are there any other simple ways ?
S
I'm sorry, I have misinterpreted your question.
On Mon, Sep 26, 2016 at 12:59:04PM -0400, bruce wrote:
> I've got a page from a web fetch. I'm simply trying to go from utf-8 to
> ascii.
Why would you do that? It's 2016, not 1953, and ASCII is well and truly
obsolete. (ASCII was even obsolete i
How can I convert Unicode to Ascii by stripping of any non ascii characters.
one way is to filter on s like
ascii = ''.join(filter(lambda x: 0 <= ord(x) < 256, unicode_string))
but are there any other simple ways ?
Regards
Srinivas Devaki
Senior (final yr) student at Indian Institute of Technol
Hey folks. (peter!)
Thanks for the reply.
I wound up doing:
#s=s.replace('\u2013', '-')
#s=s.replace(u'\u2013', '-')
#s=s.replace(u"\u2013", "-")
#s=re.sub(u"\u2013", "-", s)
s=s.encode("ascii", "ignore")
s=s.replace(u"\u2013", "-")
s=s.replace("–", "-") ##<<< this was actually in
bruce wrote:
> Hi.
>
> Ive got a "basic" situation that should be simpl. So it must be a user
> (me) issue!
>
>
> I've got a page from a web fetch. I'm simply trying to go from utf-8 to
> ascii. I'm not worried about any cruft that might get stripped out as the
> data is generated from a us sit
On Mon, Sep 26, 2016 at 12:59:04PM -0400, bruce wrote:
> When I look at the input content, I have :
>
> u'English 120 Course Syllabus \u2013 Fall \u2013 2006'
>
> So, any pointers on replacing the \u2013 with a simple '-' (dash) (or I
> could even handle just a ' ' (space)
You misinterpret wha
Hi.
Ive got a "basic" situation that should be simpl. So it must be a user (me)
issue!
I've got a page from a web fetch. I'm simply trying to go from utf-8 to
ascii. I'm not worried about any cruft that might get stripped out as the
data is generated from a us site. (It's a college/class dataset
On 04/17/2015 04:39 AM, Samuel VISCAPI wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
Hi,
This is my first post to that mailing list if I remember correctly, so
hello everyone !
Welcome to the list.
I've been stuck on a simple problem for the past few hours. I'd just
like raw_input
On 17/04/15 09:39, Samuel VISCAPI wrote:
hello everyone !
Hello, and welcome.
I've been stuck on a simple problem for the past few hours. I'd just
like raw_input to work with accentuated characters.
For example:
firstname = str.capitalize(raw_input('First name: '))
where firstname could be
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
Hi,
This is my first post to that mailing list if I remember correctly, so
hello everyone !
I've been stuck on a simple problem for the past few hours. I'd just
like raw_input to work with accentuated characters.
For example:
firstname = str.capi
Aaron Misquith wrote:
> I'm trying to obtain the questions present in StackOverflow for a
> particular tag.
>
> Whenever I try to run the program i get this *error:*
>
> Message File Name Line Position
> Traceback
> C:\Users\Aaron\Desktop\question.py 20
> UnicodeEncodeError: 'ascii' codec c
I'm trying to obtain the questions present in StackOverflow for a
particular tag.
Whenever I try to run the program i get this *error:*
Message File Name Line Position
Traceback
C:\Users\Aaron\Desktop\question.py 20
UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
positi
On Sun, Dec 29, 2013 at 5:58 PM, Steven D'Aprano wrote:
> If you want to test for something that a human reader will recognise as
> a "whole number", s.isdigit() is probably the best one to use.
isdigit() includes decimal digits plus other characters that have a digit value:
>>> print u'\N{s
On Mon, Dec 30, 2013 at 09:58:10AM +1100, Steven D'Aprano wrote:
> What gives you that impression? isspace works on Unicode strings too.
>
> py> ' x'.isspace()
> False
> py> ''.isspace()
> True
Oops, the above was copied and pasted from Python 3, which is why there
are no u' prefixes. But
On Sun, Dec 29, 2013 at 02:36:32PM +0100, Ulrich Goebel wrote:
> Hallo,
>
> I have a unicode string s, for example u"abc", u"äöü", u"123" or
> something else, and I have to find out wether
>
> 1. s is not empty and contains only digits (as in u"123", but not in
> u"3.1415")
>
> or
>
> 2. s is
On Sun, 29 Dec 2013 19:20:04 +, Mark Lawrence
wrote:
> 2. s is empty or contains only whitespaces
Call strip() on it. If it's now empty, it was whitespace.
--
DaveA
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription o
On 29/12/2013 13:36, Ulrich Goebel wrote:
Hallo,
I have a unicode string s, for example u"abc", u"äöü", u"123" or
something else, and I have to find out wether
1. s is not empty and contains only digits (as in u"123", but not in
u"3.1415")
or
2. s is empty or contains only whitespaces
For al
Hallo,
I have a unicode string s, for example u"abc", u"äöü", u"123" or
something else, and I have to find out wether
1. s is not empty and contains only digits (as in u"123", but not in
u"3.1415")
or
2. s is empty or contains only whitespaces
For all other cases I would assume a "normal"
Marilyn Davis schreef op wo 14-11-2012 om 13:23 [-0800]:
> I found this site:
> http://hints.macworld.com/article.php?story=20100713130450549
>
> and that fixes it.
Short answer: It is not a fix but a workaround. Try:
print symbol.encode('utf-8')
Longer answer: It is not really a fix, it is a wo
On 11/14/2012 04:07 PM, Marilyn Davis wrote:
>
>
> Goodness! I didn't expect it to be a Mac thing.
>
> So, on a Windows machine, running Python 2.6.6, sys.stdout.encoding is
> 'cp1252', yet the code runs fine.
>
> On Ubuntu with 2.7, it's 'UTF-8' and it runs just fine.
>
> I find this most myste
On Wed, November 14, 2012 1:07 pm, Marilyn Davis wrote:
> Thank you, Dave, for looking at my problem, and for correcting me on my
> top posting.
>
> See below:
>
>
> On Wed, November 14, 2012 12:34 pm, Dave Angel wrote:
>
>
>> On 11/14/2012 03:10 PM, Marilyn Davis wrote:
>>
>>
>>> Hi,
>>>
>>>
>>>
Thank you, Dave, for looking at my problem, and for correcting me on my
top posting.
See below:
On Wed, November 14, 2012 12:34 pm, Dave Angel wrote:
> On 11/14/2012 03:10 PM, Marilyn Davis wrote:
>
>> Hi,
>>
>>
>> Last year, I was helped so that this ran nicely on my 2.6:
>>
>>
>> #! /usr/bin/e
On 11/14/2012 03:10 PM, Marilyn Davis wrote:
> Hi,
>
> Last year, I was helped so that this ran nicely on my 2.6:
>
> #! /usr/bin/env python
> # -*- coding: utf-8 -*-
> # necessary for python not to complain about "¥"
>
> symbol = unichr(165)
> print unicode(symbol)
>
> --- end of code ---
>
> But,
Hi,
Last year, I was helped so that this ran nicely on my 2.6:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# necessary for python not to complain about "¥"
symbol = unichr(165)
print unicode(symbol)
--- end of code ---
But, now on my 2.7, and on 2.6 when I tried reinstalling it, I get:
bas
On 05/09/2012 16:18, eryksun wrote:
On Wed, Sep 5, 2012 at 10:51 AM, Ray Jones wrote:
subprocess.call(['dolphin', '/my_home/testdir/\u044c\u043e\u0432'])
Dolphin's error message: 'The file or folder
/my_home/testdir/\u044c\u043e\u0432 does not exist'
"\u" only codes a BMP character in unico
On 09/05/2012 08:18 AM, eryksun wrote:
> On Wed, Sep 5, 2012 at 10:51 AM, Ray Jones wrote:
>> subprocess.call(['dolphin', '/my_home/testdir/\u044c\u043e\u0432'])
>>
>> Dolphin's error message: 'The file or folder
>> /my_home/testdir/\u044c\u043e\u0432 does not exist'
> "\u" only codes a BMP charac
On 06/09/12 00:51, Ray Jones wrote:
subprocess.call(['dolphin', '/my_home/testdir/\u044c\u043e\u0432'])
Dolphin's error message: 'The file or folder
/my_home/testdir/\u044c\u043e\u0432 does not exist'
That's because you're telling Dolphin to look for a file literally called:
BACKSLASH u ZERO
On 06/09/12 00:04, Ray Jones wrote:
On 09/05/2012 04:52 AM, Peter Otten wrote:
Ray Jones wrote:
But doesn't that entail knowing in advance which encoding you will be
working with? How would you automate the process while reading existing
files?
If you don't *know* the encoding you *have* to
On Wed, Sep 5, 2012 at 10:51 AM, Ray Jones wrote:
>
> subprocess.call(['dolphin', '/my_home/testdir/\u044c\u043e\u0432'])
>
> Dolphin's error message: 'The file or folder
> /my_home/testdir/\u044c\u043e\u0432 does not exist'
"\u" only codes a BMP character in unicode literals, i.e. u"unicode
lite
Ray Jones wrote:
> On 09/05/2012 04:52 AM, Peter Otten wrote:
>> Ray Jones wrote:
>>
>>>
>>> But doesn't that entail knowing in advance which encoding you will be
>>> working with? How would you automate the process while reading existing
>>> files?
>> If you don't *know* the encoding you *have* t
On 09/05/2012 07:51 AM, Ray Jones wrote:
> subprocess.call(['dolphin', '/my_home/testdir/\u044c\u043e\u0432'])
>
> Dolphin's error message: 'The file or folder
> /my_home/testdir/\u044c\u043e\u0432 does not exist'
>
> But if I copy the characters as seen by Bash's shell and paste them into
> my sub
On 09/05/2012 07:31 AM, eryksun wrote:
> On Wed, Sep 5, 2012 at 5:42 AM, Ray Jones wrote:
>> I have directory names that contain Russian characters, Romanian
>> characters, French characters, et al. When I search for a file using
>> glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of th
On Wed, Sep 5, 2012 at 5:42 AM, Ray Jones wrote:
> I have directory names that contain Russian characters, Romanian
> characters, French characters, et al. When I search for a file using
> glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of the
> directory names. I thought simply identi
On 09/05/2012 04:52 AM, Peter Otten wrote:
> Ray Jones wrote:
>
>>
>> But doesn't that entail knowing in advance which encoding you will be
>> working with? How would you automate the process while reading existing
>> files?
> If you don't *know* the encoding you *have* to guess. For instance you c
Ray Jones wrote:
>> You can work around that by specifying the appropriate encoding
>> explicitly:
>>
>> $ python tmp2.py iso-8859-5 | cat
>> �
>> $ python tmp2.py latin1 | cat
>> Traceback (most recent call last):
>>File "tmp2.py", line 4, in
>>print u"Я".encode(encoding)
>> UnicodeEncodeError:
On 09/05/2012 03:33 AM, Peter Otten wrote:
> Ray Jones wrote:
>
>> I have directory names that contain Russian characters, Romanian
>> characters, French characters, et al. When I search for a file using
>> glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of the
>> directory names. I tho
Ray Jones wrote:
> I have directory names that contain Russian characters, Romanian
> characters, French characters, et al. When I search for a file using
> glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of the
> directory names. I thought simply identifying them as Unicode would
> cl
On 09/05/2012 02:57 AM, Walter Prins wrote:
> Hi Ray,
>
> On 5 September 2012 10:42, Ray Jones wrote:
>> Can someone point me to a page that will clarify the concepts, not just
>> try to show me the Python implementation of what I already don't
>> understand? ;)
> Try the following 2 links which s
Hi Ray,
On 5 September 2012 10:42, Ray Jones wrote:
> Can someone point me to a page that will clarify the concepts, not just
> try to show me the Python implementation of what I already don't
> understand? ;)
Try the following 2 links which should hopefully help:
http://www.joelonsoftware.com/
I have directory names that contain Russian characters, Romanian
characters, French characters, et al. When I search for a file using
glob.glob(), I end up with stuff like \x93\x8c\xd1 in place of the
directory names. I thought simply identifying them as Unicode would
clear that up. Nope. Now I hav
Aye, thank you. I do like that syntax better.
Sometimes it's time to just quit and try again later when I'm not so
frustrated. That's when I make silly bugs.
But, we got it!
Thank you again. I think it's a nifty hack.
M
On Sat, May 28, 2011 3:53 pm, Alexandre Conrad wrote:
> Marilyn,
>
>
Marilyn,
You miss-typed the line, it should have a semicolon right after the
word "coding", such as:
# coding: utf-8
not
# coding utf-8
as you showed from your file.
The syntax suggested syntax # -*- coding: utf8 -*- by Martin is
equivalent, but I always have a hard time remembering it from t
Thank you Martin,
This:
#!/usr/bin/env python
# -*- coding: utf8 -*-
'''Unicode handling for 2.6.
'''
[rest of module deleted]
produces an emacs warning:
Warning (mule): Invalid coding system `utf8' is specified
for the current buffer/file by the :coding tag.
It is highly recommended to fix it
Thank you Alexandre for your quick reply.
I tried your suggestion (again) and I still get:
./uni.py
File "./uni.py", line 20
SyntaxError: Non-ASCII character '\xa5' in file ./uni.py on line 21, but
no encoding declared; see http://www.python.org/peps/pep-0263.html for
details
Can you suggest a
Hello there,
: I'm still on Python 2.6 and I'm trying to work some unicode
: handling.
:
: I've spent some hours on this snippet of code, trying to follow
: PEP 0263, since the error tells me to see it. I've tried other
: docs too and I am still clueless.
OK, so this is PEP 0263. htt
When Python loads your file from your file system, it assumes all
characters in the file are ASCII. But when it hits non-ASCII
characters (currency symbols), Python doesn't know how to interpret
it. So you can give Python a hint by putting at the top of your file
the encoding of your file:
After t
Hi,
I'm still on Python 2.6 and I'm trying to work some unicode handling.
I've spent some hours on this snippet of code, trying to follow PEP 0263,
since the error tells me to see it. I've tried other docs too and I am
still clueless.
The code works, except for the comment at the end.
I would
"danielle davout" wrote
I simplify it to
v = u'\u0eb4'
X = (1,)
gen = ((v ,v) for x in X for y in X)
What can be so wrong in this line, around it to give the 1lined file
ໄ:ໄ
where ໄ "is" not u'\u0eb4' but u'\u0ec4' though a direct printing
looks OK
The code will produce a one line file wi
Hi,
I really badly need any start of explanation ..
Please help me !
I have got a list of 64 generators from which I generate files.
58 give what I expected
1 is getting me mad, not the first, not the last the fifth...
I simplify it to
v = u'\u0eb4'
X = (1,)
gen = ((v ,v) for x in X for y in X)
On Sat, Dec 26, 2009 at 10:41 AM, spir wrote:
> OK, I'll answer myself ;-)
> Found needed information at http://www1.tip.nl/~t876506/utf8tbl.html
> See below new version,
I'm not at all sure what you are trying to do here. Is it more than
conversion between unicode and utf-8? It looks like you ha
OK, I'll answer myself ;-)
Found needed information at http://www1.tip.nl/~t876506/utf8tbl.html
See below new version,
Denis
la vita e estrany
http://spir.wikidot.com/
=
# coding: utf8
import sys ; end = sys.exit
# constant
max_co
Special offer for coders coding on Christmas day!
I'm looking for the simplest way to decode/encode unicode ordinals (called
'codes' below) to/from utf8. Find this rather tricky, esp because of variable
number of meaningful bits in first octet. Specifically, for encoding, is there
a way to avoi
Lie Ryan wrote:
> > funnychars = u"éèêëóòôöáàâäÉÈÊËÓÒÔÖÁÀÂÄ"
> > asciichars = ""
> >
In addition to Lie's reply, you will very probably need diacritic-free chars to
be unicode, too. Otherwise prepare for later UnocideEn/De-codeError-s. As a
rule of thumb, if you work wi
On 11/27/2009 12:06 PM, Alan Gauld wrote:
Huh?! Was this to the right place?
It doesn't seem to be related to the previous posts in the thread?
Confused
Alan G.
whoops.. wrong thread...
___
Tutor maillist - Tutor@python.org
To unsubscribe o
Huh?! Was this to the right place?
It doesn't seem to be related to the previous posts in the thread?
Confused
Alan G.
"Lie Ryan" wrote in message
news:hen7am$4r...@ger.gmane.org...
On 11/27/2009 10:43 AM, The Music Guy wrote:
> Next thing is, I can't see logically how the path of the di
On 11/27/2009 10:43 AM, The Music Guy wrote:
> Next thing is, I can't see logically how the path of the discussion of
> the proposal lead to the proposal being rejected. It looked like a lot
> of people really liked the idea--including Guido himself--and several
> examples were given about how it
he face of ambiguity, refuse the temptation to guess.
~~
--- On Thu, 11/26/09, Lie Ryan wrote:
From: Lie Ryan
Subject: Re: [Tutor] unicode mapping doesn't work
To: tutor@python.org
Date: Thursday, November 26, 2009, 5:33 PM
Al
Albert-Jan Roskam wrote:
Hi,
I want to substitute some letters with accents with theire non-accented
equivalents. It should be easy, but it doesn't work. What am I doing wrong?
trans = {}
funnychars = u"éèêëóòôöáàâäÉÈÊËÓÒÔÖÁÀÂÄ"
asciichars = ""
for f, a in zip(funnycha
Hi,
I want to substitute some letters with accents with theire non-accented
equivalents. It should be easy, but it doesn't work. What am I doing wrong?
trans = {}
funnychars = u"éèêëóòôöáàâäÉÈÊËÓÒÔÖÁÀÂÄ"
asciichars = ""
for f, a in zip(funnychars, asciichars):
trans.u
spir wrote:
[back to the list after a rather long break]
Hello,
I stepped on a unicode issue ;-) (one more)
Below an illustration:
class U(unicode):
def __str__(self):
return self
# if you can't properly see the string below,
# 128
===
[back to the list after a rather long break]
Hello,
I stepped on a unicode issue ;-) (one more)
Below an illustration:
===
class U(unicode):
def __str__(self):
return self
# if you can't properly see the string below,
# 128
¶ÿµ ¶ÿµ ¶ÿµ
¶ÿµ ¶ÿ
"Dinesh B Vadhia" wrote in message
news:col103-ds25bb23a18e216061c32eb1a3...@phx.gbl...
Hi! I'm processing a large number of xml files that are all declared as
utf-8 encoded in the header ie.
My Python environment has been set for 'utf-8' through site.py.
It's a bad idea to change th
That was very useful - thanks! Hopefully, I'm "all Unicode" now.
From: wesley chun
Sent: Thursday, June 04, 2009 10:45 AM
To: Dinesh B Vadhia ; tutor@python.org
Subject: Re: [Tutor] unicode, utf-8 problem again
>> But, I still get this error:
>> Trace
>> But, I still get this error:
>> Traceback (most recent call last):
>> ...
>> UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in
>> position 76: ordinal not in range(128)
>> What am I missing?
>
> Take a read through http://evanjones.ca/python-utf8.html which will give you
>
Okay, I get it now ... reading/writing files with the codecs module and the
'utf-8' option fixes it. Thanks!
From: Christian Witts
Sent: Thursday, June 04, 2009 7:05 AM
To: Dinesh B Vadhia
Cc: tutor@python.org
Subject: Re: [Tutor] unicode, utf-8 problem again
Dinesh B Va
Dinesh B Vadhia wrote:
Hi! I'm processing a large number of xml files that are all declared
as utf-8 encoded in the header ie.
My Python environment has been set for 'utf-8' through site.py.
Additionally, the top of each program/module has the declaration:
# -*- coding: utf-8 -*-
But,
Hi! I'm processing a large number of xml files that are all declared as utf-8
encoded in the header ie.
My Python environment has been set for 'utf-8' through site.py. Additionally,
the top of each program/module has the declaration:
# -*- coding: utf-8 -*-
But, I still get this error:
Tr
unces+mpirritano=ochca@python.org
[mailto:tutor-bounces+mpirritano=ochca@python.org] On Behalf Of Kent
Johnson
Sent: Monday, April 06, 2009 5:51 PM
To: Pirritano, Matthew
Cc: Python Tutor
Subject: Re: [Tutor] unicode to plain text conversion
On Mon, Apr 6, 2009 at 6:48 PM, Pirritano, Matthew
On Tue, Apr 7, 2009 at 10:44 AM, Pirritano, Matthew
wrote:
> How can I find out the type of coding that was used to create this file?
> Is there a way to do this other than just asking the person who created
> it? That is possible, but I was just curious.
If you can look at the data as hex value
hca@python.org
[mailto:tutor-bounces+mpirritano=ochca@python.org] On Behalf Of Alan
Gauld
Sent: Tuesday, April 07, 2009 1:42 AM
To: tutor@python.org
Subject: Re: [Tutor] unicode to plain text conversion
"Pirritano, Matthew" wrote
> I am a total newbie. I have a very large file >
"Pirritano, Matthew" wrote
I am a total newbie. I have a very large file > 4GB that I need to
convert from Unicode to plain text. I used to just use dos when the file
was < 4GB but it no longer seems to work. Can anyone point me to some
python code that might perform this function?
When you s
On Mon, Apr 6, 2009 at 6:48 PM, Pirritano, Matthew wrote:
> Hello python people,
>
> I am a total newbie. I have a very large file > 4GB that I need to
> convert from Unicode to plain text. I used to just use dos when the file
> was < 4GB but it no longer seems to work. Can anyone point me to some
> Previously I was able to convert just by using:
> Type Unicode_filename.txt > new_text_file.txt
> That's it.
wow, if that's all you had to do, i'm not sure it's worthwhile to
learning a new programming language just to process it with an
application when your original solution was so dead simpl
ilto:wes...@gmail.com]
Sent: Monday, April 06, 2009 4:40 PM
To: Pirritano, Matthew
Cc: Python Tutor
Subject: Re: [Tutor] unicode to plain text conversion
> I am a total newbie. I have a very large file > 4GB that I need to
> convert from Unicode to plain text. I used to just use dos when the
> I am a total newbie. I have a very large file > 4GB that I need to
> convert from Unicode to plain text. I used to just use dos when the file
> was < 4GB but it no longer seems to work. Can anyone point me to some
> python code that might perform this function?
can you elaborate on your convers
Hello python people,
I am a total newbie. I have a very large file > 4GB that I need to
convert from Unicode to plain text. I used to just use dos when the file
was < 4GB but it no longer seems to work. Can anyone point me to some
python code that might perform this function?
Thanks
Matt
Matthew
On Fri, Aug 22, 2008 at 2:23 PM, eShopping
<[EMAIL PROTECTED]> wrote:
> Hi
>
> I am trying to read in non-ASCII data from file using Unicode, with this
> test app:
>
> vocab=[("abends","in the evening"),
> ("die Auff\xFCrung","performance (of a play)"),
> ("der Au\xDFenhandel","foreign trade")
The
Hi
I am trying to read in non-ASCII data from file using Unicode, with
this test app:
vocab=[("abends","in the evening"),
("aber","but"),
("die abflughalle","departure lounge"),
("abhauen","to beat it/leave"),
("abholen","to collect/pick up"),
("das Abitur","A-levels"),
("abmachen","to take of
Hi all,
I'd like to display symbols from the international phonetic alphabet
(IPA) in a Tkinter window, but I do not manage to have them displayed
correctly, neither in a Tkinter window nor in Idle.
For example, I'd like to print the following string and get the result below:
*string*
my_text =
Hi Tutors,
I've just realized that i forgot to thank Kent Johnson for his advise on
Unicode.
Thank you kent.
Best,
Emad
On 9/18/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> Emad Nawfal wrote:
> > *Hi All Tutors,*
> > *I'm new and I'm trying to use unicode strings in my code (specifically
> > A
Emad Nawfal wrote:
> *Hi All Tutors,*
> *I'm new and I'm trying to use unicode strings in my code (specifically
> Arabic), but I get this:*
>
> IDLE 1.2.1
text = ur'المصريون'
> Unsupported characters in input
This seems to be a problem with IDLE rather than Python itself. This
message:
http
*Hi All Tutors,*
*I'm new and I'm trying to use unicode strings in my code (specifically
Arabic), but I get this:*
IDLE 1.2.1
>>> text = ur'المصريون'
Unsupported characters in input
>>> for letter in text:
print letter
Traceback (most recent call last):
File "", line 1, in
for letter i
Dear Kent,
thanks for your respond.
It is clear now.
> As a mnemonic I think of Unicode as pure unencoded data. (This is *not*
> accurate, it is a memory aid!) Then it's easy to remember that decode()
> removes encoding == convert to Unicode, encode() adds encoding ==
> convert from Unicode.
So
János Juhász wrote:
> Dear All,
>
> I would like to convert my DOS txt file into pdf with reportlab.
> The file can be seen correctly in Central European (DOS) encoding in
> Explorer.
>
> My winxp uses cp852 as default codepage.
>
> When I open the txt file in notepad and set OEM/DOS script for
Dear All,
I would like to convert my DOS txt file into pdf with reportlab.
The file can be seen correctly in Central European (DOS) encoding in
Explorer.
My winxp uses cp852 as default codepage.
When I open the txt file in notepad and set OEM/DOS script for terminal
fonts, it shows the file co
David Bear wrote:
> feedp.entry.title.decode('utf-8', 'xmlcharrefreplace')
>
> I assume it would take any unicode character and 'do the right thing',
> including replacing higher ordinal chars with xml entity refs. But I still
> get
>
> UnicodeEncodeError: 'ascii' codec can't encode character u'
I'm using universal feed parser to grab an rss feed.
I'm carefull not to use any sys.out, print, file write ops, etc, UNLESS I
use a decode('utf-i') to convert the unicode string I get from feed parser
to utf-8. However, I'm still getting the blasted decode error stating that
one of the items in t
On 8/16/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] wrote:
>
> Good start!
thanks, one of the good folks at metafiler provided the link to an excellent
introductory article
I don't think this is necessary. Did it actually fix anything? Changing
> the default encoding is not
On 8/16/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> thanks, one of the good folks at metafiler provided the link to an
> excellent introductory article
>
>
correction: metafilter
___
Tutor maillist - Tutor@python.org
http://mail.python.org/
[EMAIL PROTECTED] wrote:
> http://www.joelonsoftware.com/articles/Unicode.html
>
> I realize the following: It does not make sense to have a string without
> knowing what encoding it uses. There is no such thing as plain text.
Good start!
>
> Ok. Fine. In Mozilla, by clicking on View, Charac
dear fellow Python enthusiasts,
I recently wrote a script that grabs a file containing a list of ISO defined
countries and creates an html select element. That's all well and good, and
everything seems to work fine, except for one little nagging problem:
http://en.wikipedia.org/wiki/Aland_Island
Roman Kreuzhuber wrote:
> Thanks for the quick response!
> I see! Oh I didn't realize that it's not the list which raises an error.
> For a test I tried to insert a string containing a unicode character as
> follows:
>
> ListObject = []
> ListObject.insert(0,u"Möälasdji")
By the way, aside from
Andre Engels wrote:
> 2007/3/26, Roman Kreuzhuber <[EMAIL PROTECTED]>:
>>
>> Thanks for the quick response!
>> I see! Oh I didn't realize that it's not the list which raises an error.
>> For a test I tried to insert a string containing a unicode character as
>> follows:
>>
>> ListObject = []
>> Lis
Roman Kreuzhuber wrote:
> Thanks for the quick response!
> I see! Oh I didn't realize that it's not the list which raises an error.
> For a test I tried to insert a string containing a unicode character as
> follows:
>
> ListObject = []
> ListObject.insert(0,u"Möälasdji")
>
> which raises: "Synt
2007/3/26, Roman Kreuzhuber <[EMAIL PROTECTED]>:
Thanks for the quick response!
I see! Oh I didn't realize that it's not the list which raises an error.
For a test I tried to insert a string containing a unicode character as
follows:
ListObject = []
ListObject.insert(0,u"Möälasdji")
which rais
ld this error have been raised too if this was an input from a
GUI-text-object?
I'm sorry for this silly question but I'm more or less completely new to
python and never encountered similar errors with different languages
roman
>From: Tim Golden <[EMAIL PROTECTED]>
>T
Roman Kreuzhuber wrote:
> I want to store multiple inputs from text fields in a list-object, which
> works as a very small databank. The problem is that this data will contain
> unicode characters
I'm not sure why you think this is a problem. A Python list can
hold anything, including unicode
Hello!
I need some help:
I want to store multiple inputs from text fields in a list-object, which
works as a very small databank. The problem is that this data will contain
unicode characters as i live in a german-speaking country. I've searched
through the internet for days but without any succ
Hum, I don't have any problems, and I don't do
anything special ...
- I use PostgreSQL, so I created my database using
UTF-8 encoding.
- my Python modules start with "# -*- coding: utf-8
-*-".
- all my modules and my templates are utf-8 encoded (I
use Vim, so I
use ":set encoding=utf-8", but it sh
Ed Singleton wrote:
> On 8/29/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
>>> The main problem I am having is in getting python not to give an
>>> error when it encounters a sterling currency sign (£, pound sign here
>>> in UK), which I suspect might be some wider problem on the mac as when
>>> I
1 - 100 of 145 matches
Mail list logo