On Tue, Sep 28, 2010 at 2:19 AM, Ron Savage <r...@savage.net.au> wrote:
> > Todd, what was your intent with the use encoding 'utf8'; line? Do you > > only want to save and restore UTF-8 encoded session data? or do you want > to > > do that PLUS have Perl consider your script (i.e., file test.pl) to be > > encoded in UTF-8? I ask because I find this to be a common > misunderstanding > > about UTF-8. The 'use encoding...' line is usually not what people > should > > use. If you only want the script to read/write UTF-8, and your script is > in > > normal ASCII/ISO-8859-1 encoding, then try this instead of the 'use > > encoding..' line to get the script to read and write UTF-8 on stdin and > > stdout: > > binmode STDIN, ":encoding(utf8)"; > > binmode STDOUT, ":encoding(utf8)"; > > > > With the above two lines, your script worked for me. > > I find that with or without these 2 lines, the code works when: > use encoding 'utf8'; > is not used, and fails when it is used. > > I sure hope we're agreed on that. > Yes, I/we agree. Add the two binmode lines to get the original program (with 'use encoding...' commented out) to work if you want UTF-8 encoding coming in and going out of the program. That should be all that is needed to use UTF-8 with stdin and stdout. -- Mark ##### CGI::Application community mailing list ################ ## ## ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ## ## ## ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ## ## ################################################################