On 01/28/2015 03:17 PM, Albert-Jan Roskam wrote:
>> I do not know how complete the support is, but this is copied from 3.4.2,
>> which uses tcl/tk 8.6.
t = "الحركات"
for c in t: print(c) # Prints rightmost char above first
>> ا
>> ل
>> ح
>> ر
>> ك
>> ا
>> ت
>
> Wow, I never knew this w
On Wed, Jan 28, 2015 8:21 AM CET Terry Reedy wrote:
>On 1/27/2015 12:17 AM, Rehab Habeeb wrote:
>> Hi there python staff
>> does python support arabic language for texts ? and what to do if it
>> support it?
>> i wrote hello in Arabic using codeskulptor and the powers
On 1/27/2015 12:17 AM, Rehab Habeeb wrote:
Hi there python staff
does python support arabic language for texts ? and what to do if it
support it?
i wrote hello in Arabic using codeskulptor and the powershell just for
testing and the same error appeared( a sytanx error in unicode)!!
I do not kno
On Tue, Jan 27, 2015, at 12:25, Mark Lawrence wrote:
> People might find this http://bugs.python.org/issue1602 and hence this
> https://github.com/Drekin/win-unicode-console useful. The latter is
> available on pypi.
However, Arabic is one of those scripts that runs up against the real
limitati
On 27/01/2015 16:13, random...@fastmail.us wrote:
On Tue, Jan 27, 2015, at 00:17, Rehab Habeeb wrote:
Hi there python staff
does python support arabic language for texts ? and what to do if it
support it?
i wrote hello in Arabic using codeskulptor and the powershell just for
testing and the same
On Tue, Jan 27, 2015, at 00:17, Rehab Habeeb wrote:
> Hi there python staff
> does python support arabic language for texts ? and what to do if it
> support it?
> i wrote hello in Arabic using codeskulptor and the powershell just for
> testing and the same error appeared( a sytanx error in unicode)
On Tue, Jan 27, 2015 at 4:17 PM, Rehab Habeeb
wrote:
> Hi there python staff
> does python support arabic language for texts ? and what to do if it support
> it?
> i wrote hello in Arabic using codeskulptor and the powershell just for
> testing and the same error appeared( a sytanx error in unicod
Ben Edwards (lists) wrote:
> Firstly sys.setdefaultencoding('iso−8859−1') does not work, I have to do
> sys.setdefaultencoding = 'iso−8859−1'
That "works", but has no effect. You bind the variable
sys.setdefaultencoding to some value, but that value is never used for
anything (do sys.getdefaultenc
Ben Edwards (lists) wrote:
> I am using python 2.4 on Ubuntu dapper, I am working through Dive into
> Python.
>
> There are a couple of inconsictencies.
>
> Firstly sys.setdefaultencoding('iso-8859-1') does not work, I have to do
> sys.setdefaultencoding = 'iso-8859-1'
When you run a Python script
"Ben Edwards (lists)" <[EMAIL PROTECTED]> wrote:
> I am using python 2.4 on Ubuntu dapper, I am working through Dive
> into Python.
...
> Any insight?
> Ben
Did you follow all the instructions, or did you try to call
sys.setdefaultencoding interactively?
See:
http://diveintopython.org/xml_pro
"Ian Sparks" <[EMAIL PROTECTED]> writes:
> This is probably stupid and/or misguided but supposing I'm passed a
> byte-string value that I want to be unicode, this is what I do. I'm
> sure I'm missing something very important.
Perhaps you need to read one of the good Python Unicode tutorials,
such
ianaré wrote:
> maybe a bit off topic, but how does one find the console's encoding
> from within python?
>
In [1]: import sys
In [3]: sys.stdout.encoding
Out[3]: 'cp437'
In [4]: sys.stdin.encoding
Out[4]: 'cp437'
Kent
--
http://mail.python.org/mailman/listinfo/python-list
The most important thing that you are missing is that you need to know
the encoding used for the 8-bit-character string. Let's guess that it's
Latin1.
Then all you have to do is use the unicode() builtin function, or the
string decode method.
# >>> s = 'Jos\xe9'
# >>> s
# 'Jos\xe9'
# >>> u = unico
maybe a bit off topic, but how does one find the console's encoding
from within python?
--
http://mail.python.org/mailman/listinfo/python-list
First of all, if you run this on the console, find out your console's
encoding. In my case it is English Windows XP. It uses 'cp437'.
C:\>chcp
Active code page: 437
Then
>>> s = "José"
>>> u = u"Jos\u00e9" # same thing in unicode escape
>>> s.decode('cp437') == u # use encoding that
Edward Loper wrote:
> Walter Dörwald wrote:
>> Edward Loper wrote:
>>
>>> [...]
>>> Surely there's a better way than converting back and forth 3 times? Is
>>> there a reason that the 'backslashreplace' error mode can't be used
>>> with codecs.decode?
>>>
>>> >>> 'abc \xff\xe8 def'.decode('ascii
Walter Dörwald wrote:
> Edward Loper wrote:
>
>> [...]
>> Surely there's a better way than converting back and forth 3 times? Is
>> there a reason that the 'backslashreplace' error mode can't be used
>> with codecs.decode?
>>
>> >>> 'abc \xff\xe8 def'.decode('ascii', 'backslashreplace')
>> Trac
Edward Loper wrote:
> [...]
> Surely there's a better way than converting back and forth 3 times? Is
> there a reason that the 'backslashreplace' error mode can't be used with
> codecs.decode?
>
> >>> 'abc \xff\xe8 def'.decode('ascii', 'backslashreplace')
> Traceback (most recent call last):
>
Edward Loper wrote:
> I would like to convert an 8-bit string (i.e., a str) into unicode,
> treating chars \x00-\x7f as ascii, and converting any chars \x80-xff
> into a backslashed escape sequences. I.e., I want something like this:
>
> >>> decode_with_backslashreplace('abc \xff\xe8 def')
> u'a
Edward Loper <[EMAIL PROTECTED]> wrote:
>I would like to convert an 8-bit string (i.e., a str) into unicode,
>treating chars \x00-\x7f as ascii, and converting any chars \x80-xff
>into a backslashed escape sequences. I.e., I want something like this:
>
> >>> decode_with_backslashreplace('abc \xff
Hi Max. Many thanks for helping to realize where I was missing the point
and making this clearer.
Regards,
David
Max Erickson wrote:
> The encoding argument to unicode() is used to specify the encoding of the
> string that you want to translate into unicode. The interpreter stores
> unicode as
Hi Erik. Thank you for your reply. The advice I has helped clarify this
for me.
Regards,
David
Erik Max Francis wrote:
> David Pratt wrote:
>
>
>>This is not working for me. Can someone explain why. Many thanks.
>
>
> Because '\xbe' isn't UTF-8 for the character you want, '\xc2\xbe' is, as
Hi Martin. Many thanks for your reply. What I am reall after, the
following accomplishes.
>
> If you are looking for "at the same time", perhaps this is also
> interesting:
>
> py> unicode('\xbe', 'windows-1252').encode('utf-8')
> '\xc2\xbe'
>
Your answer really helped quite a bit to clarify t
The encoding argument to unicode() is used to specify the encoding of the
string that you want to translate into unicode. The interpreter stores
unicode as unicode, it isn't encoded...
>>> unicode('\xbe','cp1252')
u'\xbe'
>>> unicode('\xbe','cp1252').encode('utf-8')
'\xc2\xbe'
>>>
max
--
ht
David Pratt wrote:
> I want to prepare strings for db storage that come from normal Windows
> machine (cp1252) so my understanding is to unicode and encode to utf-8
> and to store properly.
That also depends on the database. The database must accept
UTF-8-encoded strings, and must not modify them
David Pratt wrote:
> This is not working for me. Can someone explain why. Many thanks.
Because '\xbe' isn't UTF-8 for the character you want, '\xc2\xbe' is, as
you just showed yourself in the code snippet.
--
Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/
San Jose, CA, US
On Tue, 23 Nov 2004 20:37:04 +0100, =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
<[EMAIL PROTECTED]> wrote:
>Steve Holden wrote:
>> Am I the only person who found it scary that Bengt could apparently
>> casually drop on a polynomial the would decode to " Löwis"?
Well, don't give me too much credit
27 matches
Mail list logo