Next question about russian encoding, mssql and python

Next question about russian encoding, mssql and python.

I have this simple code:

import pymssql
import codecs
conn=pymssql.connect(host='localhost:1433', user='sa',  password='password', database='TvPgms')
cur = conn.cursor()
cur.execute('SELECT TOP 5 CAST( Name AS nvarchar(400) ), CONVERT(nvarchar(400), idProgram) FROM dbo.Programs')
print h

I get the error: LookUp Error : Unnown Encoding: ????? ?????? ???????

I cant reed russian varchar filds from MSSQL. But when i just print string in the same code all is ok, it print me normal russian characters. Who know how?

If I truing just print h insted of codecs.lookup than i get no error, but it prints me ???????? ?????????


codecs.lookup takes an encoding name, not some random string, and you probably don't need it here anyway. I think at the moment you cannot reliably print Unicode strings from Python to the Windows console due to deep technical problems. Try writing to a file or using the WriteConsoleW function directly (via ctypes) instead.

Need Your Help

binary -> UTF-8 -> string

python utf-8 encode

I'm trying to understand Unicode and all asociated things. I have made an utf-8.txt file which obviously is encoded in utf-8. It has "Hello world!" inside.

C# Create Instance of Color from any supported Format (Win.Forms Properties -> Color)

c# colors parsing

What is the best way to instantiate a new Color from any supported value, like for example