0

I'm doing a project with Matlab.

This project is about Thai license plate recognition.

I have a problem with encoding-utf8 (I guess).

The program can recognize and show data in Thai but inserting data in table can't show Thai character. (ex. กข1234 --> ??1234 )

I set collation in utf8_unicode_ci. Did i do anything wrong?

Thank you

Here is some of my code

%# Database
   javaaddpath('mysql-connector-java-5.1.6-bin.jar');
    host = 'localhost:3306';
   user = 'root';
   password = '';
   dbName = 'smart parking'; 

%# JDBC parameters
   jdbcString = sprintf('jdbc:mysql://%s/%s', host, dbName);
   jdbcDriver = 'com.mysql.jdbc.Driver';

%# Create the database connection object
   conn = database(dbName, user , password, jdbcDriver, jdbcString);
    exec(conn, 'SET character_set_results=UTF-8');
    exec(conn, 'SET character_set_client=UTF-8');
    exec(conn, 'SET character_set_connection=UTF-8');
    exec(conn, 'SET character_set_server=UTF-8');
    exec(conn, 'SET NAMES utf8');

% check to make sure that we successfully connected

   if isconnection(conn) 
   SQL_x = ['SELECT * FROM tbl_information WHERE sPlate = ''' R_str ''' AND sOut = 0'];
   curs_x = exec(conn, SQL_x);
   curs_x = fetch(curs_x);
   QUERY_x = curs_x.Data;

       if strcmp(QUERY_x, 'No Data') == 1

          Plate = R_str;
          Sql = ['INSERT INTO tbl_information(sPlate, sTimeIn, sTimeOut, sUse, sPrice, sOut) VALUES(''' Plate ''', ''' datestr(now) ''', '''' , 0, 0, 0)'];
          curs = exec(conn, Sql); 


        end
   end

   set(handles.text8, 'String', R_str);
   drawnow;

0 Answers0