-1

I switched an self developed Web-Application based on Perl/CGI and MySQL from one server to another and since then, special characters from database content like german umlauts are shown as black diamond with question mark. Everything else, even text with umlauts which is coming from the script is ok. After lot of research I have still no clue what might cause the issue.

The original server is openSuSE 13.1 with Perl 5.18.1 and MySQL 5.6.25 while the new server is Debian 8 with Perl 5.20.2 and MySQL 5.5.44. I transfered all files with zipped tar files and configured MySQL and Apache identically, i.e. setting utf-8 and so on. After dumping and restoring sql data I was able to verify that data in new MySQL is fine.

I tried many things so far, playing around with use Encode and use utf8 in Perl, setting DBI with utf8 but nothing helps. Feel quite lost now, so any hint is appreciated. Let me know if more info is necessary.

Kind regards, Uwe

Adspectus
  • 11
  • 3
  • when connecting, do you have { mysql_enable_utf8 => 1} set? – bytepusher Aug 15 '15 at 15:04
  • Yes, on new server it is set. On old server I did not need it for any reason. – Adspectus Aug 15 '15 at 15:12
  • well then the question is unfortunately quite broad: you will have to check each time data comes in and when it comes out. use utf8, btw, only says that characters in that specific file are utf8, so most of the time does not help. use open ':std', ':encoding(UTF-8)'; should ensure your print output works, so if print output is mangled then, it would probably be off. For some more in-depth look at utf8, see e.g. this post, I found it useful debugging my own problems: http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/6163129#6163129 – bytepusher Aug 15 '15 at 15:18
  • I have also had problems at some point with regexes on utf8 strings and perl versions, though that was prior to 5.18 if I remember correctly, still, might be something to look at as well. – bytepusher Aug 15 '15 at 15:21
  • How can you not know if this is an input or output problem? What does `sprintf("%vX", $str_from_database)` give? – ikegami Aug 15 '15 at 18:08

1 Answers1

0

The post suggested by bytepusher helped me. When I use use utf8; AND use open ':std', ':encoding(UTF-8)'; everything works fine. However, I am still wondering why it did work without these statements on the old machine...

Adspectus
  • 11
  • 3