[Tutor] Encoding

Giorgio anothernetfellow at gmail.com
Wed Mar 3 14:11:57 CET 2010


Oh, sorry, let me update my last post:

if i have a string, let's say:

s = "hi giorgio";

and want to store it in a latin1 db, i need to convert it to latin1 before
storing, right?

2010/3/3 Giorgio <anothernetfellow at gmail.com>

>
>>>  byte_string = unicode_string.encode('utf-8')
>>
>> If you use unicode strings throughout your application, you will be happy
>> with the above. Note that this is an advice, not a condition.
>
>
>
> Mmm ok. So all strings in the app are unicode by default?
>
> Do you know if there is a function/method i can use to check encoding of a
> string?
>
>
>>
>> "default encodings" are bad, don't rely on them.
>>
>
> No, ok, it was just to understand what i'm working with.
>
> Patrick, ok. I should check if it's possible to save unicode strings in the
> DB.
>
> Do you think i'd better set my db to utf8? I don't need latin1, it's just
> the default value.
>
> Thankyou
>
> Giorgio
>
>
> --
> --
> AnotherNetFellow
> Email: anothernetfellow at gmail.com
>



-- 
--
AnotherNetFellow
Email: anothernetfellow at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100303/a7fb2202/attachment.html>


More information about the Tutor mailing list