SQL characterset

Discuss RoboTask here
Post Reply
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

SQL characterset

Post by Rukbunker »

Hey Oleg,

I have a database set loop where the results are being saved to a TXT file. Works all fine. However, some output is:
"9038926B ?????????? ?? ??????? item name"
And it should be this:
9038926B Инструкция по монтажу item name
The data in the database is correctly saved (with the Russian text), so for sure, this is a characater set issue. In my SQL connection string, I've played a lot of with

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog={SQLCat};Data Source={SQLSERVER};Charset=ANSI;
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog={SQLCat};Data Source={SQLSERVER};Charset=UTF8;
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog={SQLCat};Data Source={SQLSERVER};Charset=UTF-8;

and all other types, but the outcome is still with the "?" signs.
Also adding
SELECT * FROM [{SQLCat}].[Dev].[ServiceAppView] WHERE FileId = 24345
CONVERT TO CHARACTER SET utf8
for example didn't help.

Any suggestions?
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: SQL characterset

Post by Oleg »

It seems the database code page and system code page do not match.
Are you sure that your database has UTF-8 format?
Oleg Yershov
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: SQL characterset

Post by Rukbunker »

Can this be something?
Charset
Charset
Capture.PNG (12.09 KiB) Viewed 9423 times
I've tried
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog={SQLCat};Data Source={SQLSERVER};Charset=Latin1;
but the result is the same.
Oleg
Site Admin
Posts: 3004
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: SQL characterset

Post by Oleg »

Your database must have Cyrillic charset (windows-1251) if information contains cyrillic symbols.
Otherwise you will get ??? instead of non-latin symbols

Another way
You have to design your database with UTF-8 charset if you want to save any non-ASCII symbols

For example MySQL database creates new database with UTF8 character set by default. You can save in such database any available symbols without problem
Oleg Yershov
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: SQL characterset

Post by Rukbunker »

Allright. Thanks for the info. I will convert it.
Rukbunker
Posts: 192
Joined: Mon Feb 22, 2016 4:06 pm
Location: Netherlands

Re: SQL characterset

Post by Rukbunker »

For what is worth, I did it another way.

I did not get permission to convert the database, the risk was too high. Which I can understand! :D

Although I didn't prefer the method, I've used Excel and connected it to the database (just a SQL query) the export the requested data. I deleted the Dataset Loop function in the task. I have to say: it works fine, fast and it has the cyrillic characters (even Chinese).

The task is now even smaller regarding the amount of steps and it's faster.
Post Reply