1

I have an oracle database which is encoded to US-ASCII because when I run the command print db.encoding, US-ASCII is the response.

My problem is that I have some special characters in the database like "ç" and "ã" and when I make some queries, these special characters are returned as question marks (?).

I need to encode the data as UTF-8 but I don't know how. I've already used methods like encode() and unicode() but nothing works.

Can anyone help me please?

Thanks.

2 Answers 2

2

I've resolved my problem with the command below before the database connection:

import os
os.environ["NLS_LANG"] = ".UTF8"
Sign up to request clarification or add additional context in comments.

Comments

0

You must create the database in Oracle with NATIONAL CHARACTER SET clause. Check this post on how to achieve this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.