I have a microsoft access database which contains columns in Punjabi Language (It is an Indian Language). I am able to read database but columns containing Punjabi language words are displayed as "?????" . Anybody know how to read data correctly ?

2 views (last 30 days)
This is a snapshot of the problem

Answers (1)

Walter Roberson
Walter Roberson on 5 May 2015
It is possible that the situation has changed with hg2 (Handle Graphics 2) as of R2014b. In versions before that (at least):
  • MATLAB GUIs and plots will not display any character beyond unicode code point 255, other than what can be invoked using tex of latex
  • MATLAB strings cannot properly display any character beyond unicode code point 65535
  • you can probably get further by accessing the Java level and using Java to output the strings
The above has to do with what MATLAB will display under the assumption that MATLAB is given the right data in the way that it wants.
If data is coming from an external source or a file, then the data might be received in one of the UTF representations and might need to be converted to MATLAB char() in order for MATLAB to have a hope of displaying it properly. In such cases you may need to use native2unicode() to convert from the UTF representation into char .
This assumes that the mechanism that is fetching the characters from the external source is not mangling them. I cannot test with MS Access, but I suspect that your interface to it is what is converting the unrepresentable characters to '?' characters. If you show your code for fetching the data from MS Access it might be possible to find a flag to receive the raw bytes. (Which, in this case, you still would not be able to display properly, but at least you would be able to write them to a file for display in outside programs.)
  1 Comment
Harsimran Singh
Harsimran Singh on 5 May 2015
Edited: Harsimran Singh on 5 May 2015
@Walter Roberson Here is code for fetching the data from ms access
slCharacterEncoding('UTF-8');
setdbprefs('DataReturnFormat', 'cellarray');
setdbprefs('NullNumberRead', 'NaN');
setdbprefs('NullStringRead', 'null');
%Make connection to database. Note that the password has been omitted. %Using ODBC driver. conn = database('Punjabi', '', '');
%Read data from database. curs = exec(conn, ['SELECT DICWEB2.ID'... ' , DICWEB2.gur'...
' , DICWEB2.Meaning'...
' , DICWEB2.Shah'...
' , DICWEB2.Type'...
' , DICWEB2.sFile'...
' FROM DICWEB2 ']);
curs = fetch(curs);
close(curs);
%Assign data to output variable
Pun1 = curs.Data;
%Close database connection.
close(conn);
%Clear variables
clear curs conn

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!