Home > database >  Mysql the LOAD_FILE how to write Chinese path and the name in Chinese?
Mysql the LOAD_FILE how to write Chinese path and the name in Chinese?

Time:09-28

Recent work on a project need to load a TXT file,
But the TXT file path and name may be in Chinese,

For example, I need to execute the following SQL statement:
Select the load_file (' E: \ \ gold. Obj);
Mysql can see the result is NULL, as shown in figure:

However, when I do the following this statement
Select the load_file (' E: \ \ 12. Obj);
The result is shown in figure:

Right-click the BLOB can see 12. The content in the obj
12. According to the inside of the obj is normal

Gold. Obj and 12. Obj is the same file, just name was changed my

For bosses to help have a look at the the load_file () how to support Chinese path?

Explain my environment configuration:
I am win10 system
MYSQL version is 5.7
Perform the show variables like '% % character; The results are as follows:

CHCP command in the CMD,
C: \ Users \ ZXC> CHCP
The active code page: 936
GBK code of the system is
I tried in the MYSQL:
The set names' GBK ';
And
The set names' gb2312 ';
The results are in the same way as initially said

Really don't know what to do,
Also don't know if the load_file () does not support Chinese path

Various bosses please!!!!!!
Thank you very much!!!!!!



CodePudding user response:

The set names' GBK ';

CodePudding user response:

Don't recommend the use of Chinese path name
 SELECT the LOAD_FILE (CONCAT (' D:/'UNHEX (' D6D0'), '. TXT ")); 

D6D0 is GBK Chinese characters "in" code

CodePudding user response:

Don't recommend the use of Chinese path name
 SELECT the LOAD_FILE (CONCAT (' E:/'UNHEX (' D6D0'), 'obj')); 


BDF0 is Chinese characters "gold" GBK code
Just stick my test cases go up directly, without modified
 
[code=SQL] [/code]

CodePudding user response:

reference 1st floor ACMAIN_CHM response:
set names' GBK ';

The set names' GBK ';
And
The set names' gb2312 ';
Tried, no use, the effect is similar to the above, namely:
12. Obj is normal, gold. Obj returns NULL

CodePudding user response:

refer to the second floor mingqing6364 response:
don't recommend the use of Chinese path name
 SELECT the LOAD_FILE (CONCAT (' D:/'UNHEX (' D6D0'), '. TXT ")); 

D6D0 are "in" GBK Chinese characters coding

Thanks for a great god, and worship

CodePudding user response:

The set names' GBK '; After the show variables like '% character %' posted to look at,

CodePudding user response:

refer to 6th floor ACMAIN_CHM response:
set names' GBK '; After the show variables like '% character %' posted to look at,

  • Related