I am using XML::Code to create some XML Data from a GET parameter received through the CGI module. The webserver is Apache with charset set to UTF-8 and the submitting form is on a page with a\[code\]<!DOCTYPE html><html lang="en-GB"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\[/code\]header. The CGI looks like this:\[code\]use CGI;use Encode;use XML::Code;binmode(STDOUT, ":utf8");binmode(STDIN, ":utf8");my $cgi = CGI->new;print $cgi->header(-type => "text/xml", -charset => "utf-8");my $object = $cgi->param("object");$object = decode("utf-8", utf8::upgrade($object));my $content = new XML::Code("formdata");$content->version ("1.0");$content->encoding ("UTF-8");my $sub_content = new XML::Code("object");$sub_content->set_text($object);$content->add_child($sub_content);$sub_content = new XML::Code("isutf");$sub_content->set_text(utf8::is_utf8($object));$content->add_child($sub_content);print $content->code();\[/code\]When calling the cgi with http://mydomain.com/cgi-bin/formdata.pl?object=? the output (as copied from firebug) is\[code\]<?xml version="1.0" encoding="UTF-8"?><formdata> <object>??</object> <isutf>1</isutf></formdata>\[/code\]Removing binmode(STDOUT, ":utf8") from the CGI gives me what I am looking for\[code\]<?xml version="1.0" encoding="UTF-8"?><formdata> <object>?</object> <isutf>1</isutf></formdata>\[/code\]Now I know how to solve this issue, but I thought I would be safe when setting everything to UTF-8. If I am not it would mean a lot more testing. Is it a bug in the perl libraries or in my thinking?Best,Marcus