On Sun, 1 May 2022 at 00:03, Vlastimil Brom wrote:
> (Even the redundant u prefix from your python2 sample is apparently
> accepted, maybe for compatibility reasons.)
Yes, for compatibility reasons. It wasn't accepted in Python 3.0, but
3.3 re-added it to make porting easier. It doesn't do anythi
have good reasons for doing so and
> will be moving to Python 3.x in due course.
>
> I have the following questions arising from the log:
>
> 1. Why does the second print statement not produce [ ║] or ["║"] ?
>
> 2. Should the second print statement produce [ ║] or [
On 28/04/2022 14:27, Stephen Tucker wrote:
To Cameron Simpson,
Thanks for your in-depth and helpful reply. I have noted it and will be
giving it close attention when I can.
The main reason why I am still using Python 2.x is that my colleagues are
still using a GIS system that has a Python pro
don't have their own str converter, so fall back to repr instead,
which outputs '[', followed by the repr of each list item separated by
', ', followed by ']'.
> 2. Should the second print statement produce [ ║] or ["║"] ?
There's certainly n
>
> >2. Should the second print statement produce [ ║] or ["║"] ?
>
> Well, to me its behaviour is correct. Do you _want_ to get your Unicode
> glyph? in quotes? That is up to you. But consider: what would be sane
> output if the list contained the string "], [3
yph? in quotes? That is up to you. But consider: what would be sane
output if the list contained the string "], [3," ?
>3. Given that I want to print a list of Unicode strings so that their
>characters are displayed (instead of their Unicode codepoint definitions),
>is there a m
oes the second print statement not produce [ ║] or ["║"] ?
2. Should the second print statement produce [ ║] or ["║"] ?
3. Given that I want to print a list of Unicode strings so that their
characters are displayed (instead of their Unicode codepoint definitions),
is there a more P
On 1/16/2014 9:16 AM, Steven D'Aprano wrote:
On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote:
Hi,
There seems to be some inconsistency in the way exceptions handle
Unicode strings.
Yes. I believe the problem lies in the __str__ method. For example,
KeyError manages to h
On 1/16/2014 7:34 AM, Ernest Adrogué wrote:
Hi,
There seems to be some inconsistency in the way exceptions handle Unicode
strings. For instance, KeyError seems to not have a problem with them
raise KeyError('a')
Traceback (most recent call last):
File "", line 1, in
In article <52d7e9a0$0$2$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote:
>
> > Hi,
> >
> > There seems to be some inconsistency in the way exceptions handle
> > Unicode stri
On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote:
> Hi,
>
> There seems to be some inconsistency in the way exceptions handle
> Unicode strings.
Yes. I believe the problem lies in the __str__ method. For example,
KeyError manages to handle Unicode, although in an ugly w
Hi,
There seems to be some inconsistency in the way exceptions handle Unicode
strings. For instance, KeyError seems to not have a problem with them
>>> raise KeyError('a')
Traceback (most recent call last):
File "", line 1, in
KeyError: 'a'
>>
Am 05.09.2013 10:33, schrieb Peter Otten:
> Kurt Mueller wrote:
>> Am 29.08.2013 11:12, schrieb Peter Otten:
>>> kurt.alfred.muel...@gmail.com wrote:
On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
> On 28/8/2013 04:32, Kurt Mueller wrote:
>> For some text manipulatio
Kurt Mueller wrote:
> Am 29.08.2013 11:12, schrieb Peter Otten:
>> kurt.alfred.muel...@gmail.com wrote:
>>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
On 28/8/2013 04:32, Kurt Mueller wrote:
> For some text manipulation tasks I need a template to split lines
> f
Am 29.08.2013 11:12, schrieb Peter Otten:
> kurt.alfred.muel...@gmail.com wrote:
>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
>>> On 28/8/2013 04:32, Kurt Mueller wrote:
For some text manipulation tasks I need a template to split lines
from stdin into a list of str
Kurt Mueller wrote:
> I have to say that I am a bit disapointed by the chardet library.
> The encoding for the single character 'ü'
> is detected as {'confidence': 0.99, 'encoding': 'EUC-JP'},
> whereas "file" says:
> $ echo "ü" | file -i -
> /dev/stdin: text/plain; charset=utf-8
> $
>
> "ü" is a
Am 29.08.2013 11:12, schrieb Peter Otten:
> kurt.alfred.muel...@gmail.com wrote:
>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
>>> On 28/8/2013 04:32, Kurt Mueller wrote:
For some text manipulation tasks I need a template to split lines
from stdin into a list of str
kurt.alfred.muel...@gmail.com wrote:
> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
>> On 28/8/2013 04:32, Kurt Mueller wrote:
>> > For some text manipulation tasks I need a template to split lines
>> > from stdin into a list of strings the way shlex.split() does it.
>> > The
Thank you for your thoughtful and thorough response. I now understand much
better what you (and apparently the others) were warning me against and I will
certainly consider that moving forward.
I very much appreciate your help as I learn about python and embedding and all
these crazy encoding
On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote:
> On 28/8/2013 04:32, Kurt Mueller wrote:
> > For some text manipulation tasks I need a template to split lines
> > from stdin into a list of strings the way shlex.split() does it.
> > The encoding of the input can vary.
> Does that
hat advice, not just the people here
but essentially the entire Python development community responsible for
adding Unicode strings to the language. Can you blame me for feeling that
your reply seemed rather arrogant?
In any case, I'm glad you responded with a little more restraint th
#
> #!/usr/bin/env python
> # vim: set fileencoding=utf-8 :
> # split lines from stdin into a list of unicode strings
> # Muk 2013-08-23
> # Python 2.7.3
>
> from __future__ import print_function
> import sys
> import shlex
> import chardet
Is this
he list of strings to be in unicode.
Here is template.py:
##
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# split lines from stdin into a list of unicode strings
# Muk 2013-08-2
I am very sorry that I have offended you to such a degree you feel it necessary
to publicly eviscerate me.
Perhaps I could have worded it like this: "So far I have not seen any troubles
including unicode characters in my strings, they *seem* to be fine for my
use-case. What kind of trouble ha
of time to introduce Unicode strings in the
first place.
Why bother using the official interface designed to work correctly with
Unicode, when you can rely on an accident of implementation that just
happens to work correctly in your environment but no guarantee it will
work correctly anyw
i am already doing (3), and all is working perfectly. bytestring literals are
fine, i'm not sure what this trouble is that you speak of.
note that i'm not using PyRun_AnyFile(), i'm loading the script myself, assumed
as utf8 (which was my original problem, i had assumed it was macRoman), then
On 25/08/2013 23:32, David M. Cotter wrote:
i got it!! OMG! so sorry for the confusion, but i learned a lot,
and i can share the result:
the CORRECT code *was* what i had assumed. the Python side has
always been correct (no need to put "u" in front of strings, it is
known that the bytes are u
i got it!! OMG! so sorry for the confusion, but i learned a lot, and i can
share the result:
the CORRECT code *was* what i had assumed. the Python side has always been
correct (no need to put "u" in front of strings, it is known that the bytes are
utf8 bytes)
it was my "run script" function
frøânçïé
20: second worked: frøânçïé
20: third worked: frøânçïé
20: ---
20: ---
20: Original string: 控件
20: converting...
20: first worked: 控件
20: second worked: 控件
20: third worked: 控件
20: -------
now, given the C++ source code, this s
On 8/25/2013 1:57 PM, David M. Cotter wrote:
i'm sorry this is so confusing, let me try to re-state the problem in as clear
a way as i can.
I have a C++ program, with very well tested unicode support. All logging is
done in utf8. I have conversion routines that work flawlessly, so i can assu
2013/8/25 David M. Cotter :
> i'm sorry this is so confusing, let me try to re-state the problem in as
> clear a way as i can.
>
> I have a C++ program, with very well tested unicode support. All logging is
> done in utf8. I have conversion routines that work flawlessly, so i can
> assure you
i'm sorry this is so confusing, let me try to re-state the problem in as clear
a way as i can.
I have a C++ program, with very well tested unicode support. All logging is
done in utf8. I have conversion routines that work flawlessly, so i can assure
you there is nothing wrong with logging and
On Sat, Aug 24, 2013, at 12:47, David M. Cotter wrote:
> > What _are_ you using?
> i have scripts in a file, that i am invoking into my embedded python
> within a C++ program. there is no terminal involved. the "print"
> statement has been redirected (via sys.stdout) to my custom print class,
>
On Sat, Aug 24, 2013 at 9:47 AM, David M. Cotter wrote:
>
> > What _are_ you using?
> i have scripts in a file, that i am invoking into my embedded python within a
> C++ program. there is no terminal involved. the "print" statement has been
> redirected (via sys.stdout) to my custom print clas
Le samedi 24 août 2013 18:47:19 UTC+2, David M. Cotter a écrit :
> > What _are_ you using?
>
> i have scripts in a file, that i am invoking into my embedded python within a
> C++ program. there is no terminal involved. the "print" statement has been
> redirected (via sys.stdout) to my custom
> What _are_ you using?
i have scripts in a file, that i am invoking into my embedded python within a
C++ program. there is no terminal involved. the "print" statement has been
redirected (via sys.stdout) to my custom print class, which does not specify
"encoding", so i tried the suggestion a
On Sat, Aug 24, 2013, at 2:45, David M. Cotter wrote:
> > you need to use u" ... " delimiters for Unicode, otherwise the results you
> > get are completely arbitrary and depend on the encoding of your terminal.
> okay, well, i'm on a mac, and not using "terminal" at all. but if i
> were, it woul
David M. Cotter wrote:
> Steven wrote:
>> I see you are using Python 2
> correct
>
>>It's hard to say what *exactly* is happening here, because you don't explain
>>how the python print statement somehow gets into your C++ Log code. Do I
>>guess right that it catches stdout?
> yes, i'm redirecting
> I see you are using Python 2
correct
> Firstly, in Python 2, the compiler assumes that the source code is encoded in
> ASCII
gar, i must have been looking at doc for v3, as i thought it was all assumed to
be utf8
> # -*- coding: utf-8 -*-
okay, did that, still no change
> you need to use u"
On Fri, 23 Aug 2013 13:49:23 -0700, David M. Cotter wrote:
> note everything works great if i use Ascii, but:
>
> in my utf8-encoded script i have this:
>
>> print "frøânçïé"
I see you are using Python 2, in which case there are probably two or
three errors being made here.
Firstly, in
note everything works great if i use Ascii, but:
in my utf8-encoded script i have this:
> print "frøânçïé"
in my embedded C++ i have this:
PyObject* CPython_Script::print(PyObject *args)
{
PyObject*resultObjP = NULL;
const char *utf8_
ny encoding that
> supports the Unicode characters used.
Unicode defines characters; UTF-8 is one way (of many) to represent
those characters in bytes. UTF-16 and UTF-32 are other ways of
representing those characters in bytes, and internally, Python
probably uses one of them - but there is no guarantee
>line = unicode(line.strip(),'utf8')
>and now i get really utf8-strings. It does work but i dont know why it works.
>For me it looks like i change an utf8-string to an utf8-string.
I would like to point out that UTF-8 is not exactly "Unicode". From what I
understand, Unicode is a standard while
On Tue, May 31, 2011 at 8:45 AM, Wolfgang Meiners
wrote:
> Am 31.05.11 13:32, schrieb Daniel Kluev:
>> On Tue, May 31, 2011 at 8:40 AM, Wolfgang Meiners
>> wrote:
>>> metadata = MetaData('sqlite://')
>>> a_table = Table('tf_lehrer', metadata,
>>> Column('id', Integer, primary_key=True),
>>>
I just found a second method on
http://docs.python.org/howto/unicode
you can use tho module codecs and then simply write
import codecs
f = codecs.open('unicode.rst', encoding='utf-8')
for line in f:
print repr(line)
Wolfgang
--
http://mail.python.org/mailman/listinfo/python-list
Am 31.05.11 11:55, schrieb Chris Withers:
> Hi Wolfgang,
>
> On 30/05/2011 22:40, Wolfgang Meiners wrote:
>> I am trying to build an application using sqlalchemy.
>
> You're likely to get much better help here:
>
> http://www.sqlalchemy.org/support.html#mailinglist
>
> When you post there, make
Am 31.05.11 13:32, schrieb Daniel Kluev:
> On Tue, May 31, 2011 at 8:40 AM, Wolfgang Meiners
> wrote:
>> metadata = MetaData('sqlite://')
>> a_table = Table('tf_lehrer', metadata,
>>Column('id', Integer, primary_key=True),
>>Column('Kuerzel', Text),
>>Column('Name', Text))
>
> Use Uni
On Tue, May 31, 2011 at 8:40 AM, Wolfgang Meiners
wrote:
> metadata = MetaData('sqlite://')
> a_table = Table('tf_lehrer', metadata,
> Column('id', Integer, primary_key=True),
> Column('Kuerzel', Text),
> Column('Name', Text))
Use UnicodeText instead of Text.
> A_record = A_class('BUM',
Hi Wolfgang,
On 30/05/2011 22:40, Wolfgang Meiners wrote:
I am trying to build an application using sqlalchemy.
You're likely to get much better help here:
http://www.sqlalchemy.org/support.html#mailinglist
When you post there, make sure you include:
- what python version you're using
- wha
rror) You must not use
8-bit bytestrings unless you use a text_factory that can interpret 8-bit
bytestrings (like text_factory = str). It is highly recommended that you
instead just switch your application to Unicode strings. u'INSERT INTO
tf_lehrer ("Kuerzel", "Name") VAL
>
> > pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
> >
> > UnicodeEncodeError: 'ascii' codec can't encode character
> > u'\xf1' in position 31: ordinal not in range(128)
> >
> > How could
On 4/26/2011 12:07 PM, Chris Rebert wrote:
On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
Hi everybody, how could I concatenate unicode strings ???
What I want to do is this:
unicode('this an example language ') + unicode('español')
but I get an:
Traceback (most recent
Chris Rebert wrote:
On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
Hi everybody, how could I concatenate unicode strings ???
What I want to do is this:
unicode('this an example language ') + unicode('español')
but I get an:
Traceback (most recent call last):
position 31: ordinal not in range(128)
>
> How could I solve that ???
> Regards
> Ariel
>
>
> On Tue, Apr 26, 2011 at 6:07 PM, Chris Rebert wrote:
>
>> On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
>> > Hi everybody, how could I concatenate unic
On Tue, 2011-04-26 at 17:58 +0200, Ariel wrote:
> Hi everybody, how could I concatenate unicode strings ???
> What I want to do is this:
>
> unicode('this an example language ') + unicode('español')
>
> but I get an:
> Traceback (most r
')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position
31: ordinal not in range(128)
How could I solve that ???
Regards
Ariel
On Tue, Apr 26, 2011 at 6:07 PM, Chris Rebert wrote:
> On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
> >
On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
> Hi everybody, how could I concatenate unicode strings ???
> What I want to do is this:
>
> unicode('this an example language ') + unicode('español')
>
> but I get an:
> Traceback (most recent call last):
>
On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
> Hi everybody, how could I concatenate unicode strings ???
> What I want to do is this:
>
> unicode('this an example language ') + unicode('español')
>
> but I get an:
> Traceback (most recent call last):
>
Hi everybody, how could I concatenate unicode strings ???
What I want to do is this:
unicode('this an example language ') + unicode('español')
but I get an:
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'ascii' codec can
Excellent! But what about the unicode
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the help, but I am going to skip this problem because I
don't need Unicode characters in a script anyway.
-- Gnarlie
--
http://mail.python.org/mailman/listinfo/python-list
"Gnarlodious" wrote in message
news:646ab38b-0710-4d31-b9e1-8a6ee7bfa...@21g2000yqj.googlegroups.com...
Well, Python 3 is supposed to be all Unicode by default. I shouldn't
even need to say
# coding:UTF-8
Yes, in Python 3, an absence of a 'coding' line assumes UTF-8.
And, the file is saved
Gnarlodious writes:
> Well, Python 3 is supposed to be all Unicode by default. I shouldn't
> even need to say
> # coding:UTF-8
>
> And, the file is saved as Unicode.
>
When a filed is saved, shouldn't it be in a specific encoding? I don't
see how you can save your file 'as unicode'. You should
On Tue, Jan 19, 2010 at 8:16 PM, Gnarlodious wrote:
> Well, Python 3 is supposed to be all Unicode by default. I shouldn't
> even need to say
> # coding:UTF-8
>
> And, the file is saved as Unicode.
>
> There are many mentions of this error found by Google, but none seen
> to clearly say what the
Well, Python 3 is supposed to be all Unicode by default. I shouldn't
even need to say
# coding:UTF-8
And, the file is saved as Unicode.
There are many mentions of this error found by Google, but none seen
to clearly say what the problem is or how to fix it.
FYI, the problem line says:
cursor.ex
you use a text_factory that can interpret 8-bit bytestrings (like
text_factory = str). It is highly recommended that you instead just
switch your application to Unicode strings.
So... how do I switch to Unicode? I thought I was doing it when I put
# coding:utf-8
at the start of my script.
All th
hly recommended that you instead just
> switch your application to Unicode strings.
>
> So... how do I switch to Unicode? I thought I was doing it when I put
# coding:utf-8
>
> at the start of my script.
>
All that does is mean that the script itself is encoded as utf8.
In Py3,
I am using Python 3, getting an error from SQLite:
sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless
you use a text_factory that can interpret 8-bit bytestrings (like
text_factory = str). It is highly recommended that you instead just
switch your application to Unicode strings
gentlestone wrote:
> the error message i've got is:
>
> 'unicode' object has no attribute 'format'
>
> is the new formatting style newer then python 2.5?
>
>
Have you tried reading the documentation? It generally tells you which
version of Python introduced a feature:
http://docs.python.org
On 9 Sep, 12:49, gentlestone wrote:
>
> I have python 2.5
>
> return u'{0}'.format(self.name)
>
> doesn't work eigther
>
> the error message i've got is:
>
> 'unicode' object has no attribute 'format'
>
> is the new formatting style newer then python 2.5?
Yes. The new string formatting appeared i
On 9. Sep., 12:31 h., Tim Northover
wrote:
> gentlestone writes:
> > return u"{}".format(self.name)
>
> > this one doesn't work on unicode strings. I there a not old formatting
> > style possibilty for unicode strings?
>
> It looks like you're
gentlestone schrieb:
return u"{}".format(self.name)
u"{0}".format(u"blah")
works for me with python-2.6.2
Maybe your format string is wrong.
- Patrick
--
http://mail.python.org/mailman/listinfo/python-list
gentlestone writes:
> return u"{}".format(self.name)
>
> this one doesn't work on unicode strings. I there a not old formatting
> style possibilty for unicode strings?
It looks like you're trying to mix python 3.1 and 2.6. In 2.6 you have
to put a number inside
return u"{}".format(self.name)
this one doesn't work on unicode strings. I there a not old formatting
style possibilty for unicode strings?
Note: self.name can be unicode string!
--
http://mail.python.org/mailman/listinfo/python-list
On Sep 4, 7:11 pm, Mathew Oakes wrote:
> Is there anything that can be done to make pexpect spawns send unicode lines?
>
> In this example they are just middot characters, but this process
> needs to be able to handle languages in other character sets.
>
> >>> spokentext = u'Nation . Search the FO
Is there anything that can be done to make pexpect spawns send unicode lines?
In this example they are just middot characters, but this process
needs to be able to handle languages in other character sets.
>>> spokentext = u'Nation . Search the FOX Nation . czars \xb7 Health care
>>> \xb7 t
Have you considered including an encoding line at the top of your file, as
described in PEP 0263:
http://www.python.org/dev/peps/pep-0263/
I just ran into a similar error, but it went away when I included
# coding: utf-8
as the first line in my file.
--
http://mail.python.org/mailman/listinfo
On Aug 25, 6:34 am, Nobody wrote:
> The underlying OS primitive can only handle bytes. If you read or write a
> (unicode) string, Python needs to know which encoding is used. For Python
> file objects created by the user (via open() etc), you can specify the
> encoding; for those created by the ru
> 7stud (7) wrote:
>7> Thanks for the response. My OS is mac osx 10.4.11. I'm not really
>7> sure how to check my locale settings. Here is some stuff I tried:
>7> $ echo $LANG
>7> $ echo $LC_ALL
>7> $ echo $LC_CTYPE
>7> $ locale
>7> LANG=
>7> LC_COLLATE="C"
>7> LC_CTYPE="C"
>7> LC_MESS
On Tue, 25 Aug 2009 03:41:54 -0700, 7stud wrote:
> Why does echoing $LC_ALL or $LC_CTYPE just give me a blank string?
Because the variables aren't set.
The default locale for a particular category (e.g. LC_CTYPE) is taken from
$LC_ALL if that is set, otherwise $LC_CTYPE, otherwise $LANG, otherwi
On Aug 24, 10:09 pm, Ned Deily wrote:
> In article
> ,
>
>
>
> 7stud wrote:
> > On Aug 24, 2:41 pm, "Martin v. Löwis" wrote:
> > > > I can't figure out a way to programatically set the encoding for
> > > > sys.stdout. So where does that leave me?
>
> > > You should be setting the terminal enco
In article
,
7stud wrote:
> On Aug 24, 2:41 pm, "Martin v. Löwis" wrote:
> > > I can't figure out a way to programatically set the encoding for
> > > sys.stdout. So where does that leave me?
> >
> > You should be setting the terminal encoding administratively, not
> > programmatically.
> >
>
>
> > You should be setting the terminal encoding administratively, not
> > programmatically.
> >
>
> The terminal encoding has always been utf-8. It was not set
> programmatically.
>
> It seems to me that python 3.1's string handling is broken.
> Apparently, in python 3.1 I am unable to explicitl
On Aug 24, 2:41 pm, "Martin v. Löwis" wrote:
> > I can't figure out a way to programatically set the encoding for
> > sys.stdout. So where does that leave me?
>
> You should be setting the terminal encoding administratively, not
> programmatically.
>
The terminal encoding has always been utf-8.
> I can't figure out a way to programatically set the encoding for
> sys.stdout. So where does that leave me?
You should be setting the terminal encoding administratively, not
programmatically.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 24, 12:19 pm, Stefan Behnel wrote:
> 7stud wrote:
> > python 3.1 won't let me
> > explicitly encode my unicode string
>
> Sure it does. But encoding a non-ASCII string to ASCII will necessarily fail.
>
As you should be able to see in the python 3.1 example I posted, I did
not encode the st
7stud wrote:
> python 3.1 won't let me
> explicitly encode my unicode string
Sure it does. But encoding a non-ASCII string to ASCII will necessarily fail.
> and python 3.1 implicitly does
> the encoding with the wrong codec.
That's not a Python problem, though. Your terminal is configured for
U
de string, and python 3.1 implicitly does
the encoding with the wrong codec. And why would any programmer rely
on python 3.1's implicit encoding of unicode strings anyway?
Presumably, different systems will have different encodings for
sys.stdout, some encodings might cause encode errors.
--
http://mail.python.org/mailman/listinfo/python-list
> I don't understand why I'm getting an encode error in python 3.1.
The default encoding is not relevant here at all. Look at
sys.stdout.encoding.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
==python 2.6 ==
import sys
print sys.getdefaultencoding()
s = u"\u20ac"
print s.encode("utf-8")
$ python2.6 1test.py
ascii
€
=python 3.1 ===
import sys
print(sys.getdefaultencoding())
s = "€"
print(s.encode("utf-8"))
print(s)
$ python3.1 1test.py
utf-8
b'\xe2\x82\xac'
Tra
On Jun 27, 9:44 pm, Benjamin Peterson wrote:
> Gaudha gmail.com> writes:
>
> > And Peter, I tried importing the __future__ module. It's also not
> > working...
>
> How so?
Sorry guys, __future__ module is working excellent :-). I had some bad
coding somewhere else, just fixed it. Anyway, thank y
Gaudha gmail.com> writes:
> And Peter, I tried importing the __future__ module. It's also not
> working...
How so?
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 27, 4:54 pm, Peter Otten <__pete...@web.de> wrote:
> MRAB wrote:
> > Gaudha wrote:
> >> I wanna make all the strings in my code unicode strings. How to do it
> >> without giving unicode switch 'u' before every string?
>
> > Use Pytho
Gaudha gmail.com> writes:
>
> Hey gentlemen,
>
> I wanna make all the strings in my code unicode strings. How to do it
> without giving unicode switch 'u' before every string?
Or the -U flag, but that's probably a bad idea.
--
http://mail.python.org/mailman/listinfo/python-list
MRAB wrote:
> Gaudha wrote:
>> I wanna make all the strings in my code unicode strings. How to do it
>> without giving unicode switch 'u' before every string?
>
> Use Python 3.1 instead.
or use
from __future__ import unicode_literals
in Python 2.6.
--
Gaudha wrote:
Hey gentlemen,
I wanna make all the strings in my code unicode strings. How to do it
without giving unicode switch 'u' before every string?
Use Python 3.1 instead.
--
http://mail.python.org/mailman/listinfo/python-list
Hey gentlemen,
I wanna make all the strings in my code unicode strings. How to do it
without giving unicode switch 'u' before every string?
--
http://mail.python.org/mailman/listinfo/python-list
icial way of printing
> unicode strings. I mean, the question is not "how can I print the unicode
> string" but "how the creators of the language suppose me to print the
> unicode string". I couldn't find an answer to this question in docs, so I
> hope somebody
on way of
> printing unicode strings?
Try these:
http://effbot.org/zone/unicode-objects.htm>
http://www.reportlab.com/i18n/python_unicode_tutorial.html>
http://www.amk.ca/python/howto/unicode>
If you want something more official, try the PEP that introduced
Unicode object
ally doing like that saves many problems.
> Especially in Python, where there is one official way to do any elementary
> task. And I just want to know what is the normal, official way of printing
> unicode strings. I mean, the question is not "how can I print the unicode
> string"
1 - 100 of 221 matches
Mail list logo