Diez B. Roggisch wrote:
So then the easiest thing to do is: take the maximum length of a unicode
string you could possibly want to store, multiply it by 4 and make that
the length of the DB field.
However, I'm pretty convinced it is a bad idea to store Python unicode
strings directly in a
Hello,
how can I get the number of byte of the string in python?
with len(string), it doesn't work to get the size of the string in
bytes if I have the unicode string but just the length. (it only works
fine for ascii/latin1) In data structure, I have to store unicode
string for many languages
e.g. I use utf8 as encoding/decoding,
s = ทดสอบ
u = s.decode(utf-8)
how can I get size of u ?
[EMAIL PROTECTED] schrieb:
Hello,
how can I get the number of byte of the string in python?
with len(string), it doesn't work to get the size of the string in
bytes if I have the unicode
[EMAIL PROTECTED] wrote:
how can I get the number of byte of the string in python?
with len(string), it doesn't work to get the size of the string in
bytes if I have the unicode string but just the length. (it only works
fine for ascii/latin1) In data structure, I have to store unicode
Stefan Behnel wrote:
[EMAIL PROTECTED] wrote:
how can I get the number of byte of the string in python?
with len(string), it doesn't work to get the size of the string in
bytes if I have the unicode string but just the length. (it only works
fine for ascii/latin1) In data structure, I have
I got the answer. What I need was so simple but I was blinded at that
moment.
Thanks for any suggestion!
f = open(test.csv, rb)
t1 = f.readline()
t2 = t1.decode(iso-8859-9) # test with turkish
t2
u'Dur-kalk trafi\u011fi, t\u0131kan\u0131kl\u0131k tehlikesi\n'
print t2
Dur-kalk
Diez B. Roggisch wrote
Stefan Behnel wrote:
[EMAIL PROTECTED] wrote:
how can I get the number of byte of the string in python?
with len(string), it doesn't work to get the size of the string in
bytes if I have the unicode string but just the length. (it only works
fine for ascii/latin1)
So then the easiest thing to do is: take the maximum length of a unicode
string you could possibly want to store, multiply it by 4 and make that
the length of the DB field.
However, I'm pretty convinced it is a bad idea to store Python unicode
strings directly in a DB, especially as they