具有中文字符的MySql转储文件

问题描述

我正在编写一个脚本,用于将blob数据转储到表中具有文件名字段的文件文件名包含 汉字。我尝试选择字段,它可以显示汉字。但是,保存在目录中的文件名会变成这样。

CREATE PROCEDURE `dump_image`()

begin
declare this_id int;    
declare cur1 cursor for select id from attachments;
set character set utf8;
open cur1;
  read_loop: loop
    fetch cur1 into this_id;        
    select this_id;
    select concat('"','c:\\\\abc-',uuid(),'-',ifnull(replace(filename,'"',''),uuid()),'"') from attachments where id=this_id into @filename;                
    set @abc = concat('select data from attachments where id=',this_id,' into dumpfile ',@filename);            
    prepare write_file from @abc;
    execute write_file;
  end loop;
close cur1;
end

文件名变为

abc-8d722cef-233d-11eb-abb4-000c297a2d92-CC æ¯æœˆç‰©æ–™å­˜å€‰è¨˜éŒ„_2018å¹´7月.pdf

我将character_set_filesystem中的my.ini更改为utf8并重新启动MysqL。但是文件名是相同的。 我该如何解决?我不能使用into outfile,而只能使用into dumpfile来使pdf正常打开。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)