Skip to content Skip to sidebar Skip to footer

Python 2.7 Connection To Oracle: Loosing (polish) Characters

I connect from Python 2.7 to Oracle data base. When I use: cursor.execute('SELECT column1 FROM table').fetchall()] I have got almost proper values for column1 because all Polish c

Solution 1:

Try setting the environment variable NLS_LANG to your database language string, something like

os.environ['NLS_LANG'] = 'POLISH_POLAND.EE8MSWIN1250'

Solution 2:

@Mark Harrison - thank you very much ! It works! There is an exact instruction what I did:

I checked in Oracle what is the language:

SELECT USERENV ('language') FROM DUAL

The response was:

POLISH_POLAND.UTF8

Then I changed NLS_LA value in Python:

os.environ['NLS_LANG'] = 'POLISH_POLAND.UTF8'

Using

print"%s, %s" % (name, surname)

and "> file.txt" in command line I obtained a (proper) file in utf8.

Post a Comment for "Python 2.7 Connection To Oracle: Loosing (polish) Characters"