Answer the question
In order to leave comments, you need to log in
matlab. Import data from MS SQL. Encoding. How to implement?
The essence of the question is simple to triviality, but for the second day I can not understand the logic - how it is necessary to work.
A simple query to a data table containing Cyrillic characters:
%Make connection to database. Note that the password has been omitted.
%Using ODBC driver.
conn = database('Test', '', '');
%Read data from database.
st = 'select top 10 * from main';
data = fetch(conn, st);
c = data.F(1)
If you run into problems with corrupted characters, for example when using MATLAB files associated with a model, try using the slCharacterEncoding function to change the character encoding.
% encoding='windows-1251';
%slCharacterEncoding(encoding);
Answer the question
In order to leave comments, you need to log in
It doesn't look like unicode. It looks like a classic windows cant and even has nothing to do with ODBC.
Try on another computer to create a file with encoding 1251, text and open it on this one. If you see the same thing - dig "locale settings". For each Windows there is a solution.
If you have an NVARCHAR (UNICODE) field you need: Convert Unicode .
It is not at all clear what type of fields are in the database.
so the poke method is:
select top 100
f=cast(f as nvarchar) ,
I=cast(I as varchar)
from main
Artem Karetnikov was right. In my case, the situation turned out to be that I had English in the system settings. More specifically:
Control Panel - Regional Options - Advanced tab - Language for non-Unicode programs
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question