wide wide world of characters

I was getting a lot of “Wide character in print” errors from a perl script. A little googling led me to this page and the solution. In short, I was printing unicode characters to an I/O layer that did not support unicode, hence the error. Adding a call to binmode solved this.

example:

open(FILEHANDLE, “>$filename”);
binmode(FILEHANDLE, “:utf8”);
printf(FILEHANDLE, “Hello World!n”);

Comments are closed.