[Linux-programlama] Re: Python dil sorunu...

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Tolgahan (besturk@gmail.com)
Date: Mon 13 Aug 2007 - 19:53:19 EEST


> import psycopg2
> cxa = psycopg2.connect(user='postgres',password='123456',database='enson')
> xa = cxa.cursor()
> f=open("kaynaklar/1.txt", "r")
> a=unicode(f.read())
> a=a.decode("utf-8")
> xa.execute("INSERT INTO links (fulltxt) VALUES ('%s')" %(a))
> cxa.commit()
>
>
> bu kodu uyguladýðýmda aþaðýdaki hatayý aldým:
>
> Traceback (most recent call last):
> File "C:\web\apache\Python25\ekle.py", line 6, in <module>
> a=unicode(f.read())
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 306:
> ordinal not in range(128)
>
> benim yapmak istediðim txtlerin içerisinden gelen verileri utf-8 db'ye
> eklemek.
> (txt'lerin içindeki verilerin dili belli deðil)
>
>
>

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.