Wide character

Updated: 10/17/2017 by Computer Hope

A wide character describes a character with a value greater than 127, 255, or that occupies more than one byte, depending on the computer or programming language.

With the Perl programming language, if a character has a value greater than 255 and no encoding layer is specified, it generates an error in the HTTP error log similar to the example below.

example.cgi: Wide character in print at example.cgi line 1077

This error occurs because Perl is trying to fit things in ISO-8859-1 for backward compatibility reason, but can't and uses UTF-8 encoding instead. To fix this error, specify the encoding by using the line below at the top of your Perl script.

binmode STDOUT, ":encoding(UTF-8)";		#Set encoding

ASCII, Software terms, UTF-8