T
T
Talik2017-10-20 20:47:26
linux
Talik, 2017-10-20 20:47:26

How to overcome the encoding problem?

Essence of the question.
There is an ORacle DB, it is created with cl8iso8859p5 (so it was historically added). For a long time, all patch rolls were made from Windows machines, where the set NLS_LANG=AMERICAN_AMERICA.CL8MSWIN1251 variable was pre-registered in the console and everything rolled perfectly.
Now there was a need to roll a patch from a Linux machine.
When pulling script files from SVN, the files get ISO-8859-1 encoding, and Russian characters are obtained in the form of krakozyabr, in the same form they go to the database.
locale is set to UTF-8 by default.
empirically picked up an encoding in which everything is displayed correctly.
iconv -f cp1251 package_name.sql.
It is necessary to convert to UTF-8, I thought, and did so.
When I started to roll scripts, I ran into an insertion problem. Those values ​​that were previously correct suddenly ceased to fit into the table column. Somewhere I found that this is an effect due to UTF-8. Now I'm in vtupore, solving one problem, I get a bunch more.
Can anyone come across similar problems of translating encodings and scripts?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
protven, 2017-10-20
@protven

Install and try like this:

export NLS_LANG=AMERICAN_AMERICA.UTF8
export LC_ALL=ru_RU.utf8

C
CityCat4, 2017-10-21
@CityCat4

this is the effect due to UTF-8

That's right, one UTF-8 character occupies two bytes. Therefore, the size of all text fields will have to be multiplied by two in this case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question