in reply to Re^6: FCGI, tied handles and wide characters
in thread FCGI, tied handles and wide characters

If you want maximum performance while still being safe, try utf8::decode. It logically decodes the string in-place, but because perl uses utf-8 internally the implementation just scans the string for utf-8 validity and then turns on the utf8 bit if it encountered any characters above 0x7F. You get the added benefit that it *doesn't* turn on the utf-8 bit if the entire string is 7-bit ascii, which can optimize code in various places when using that string.

Likewise, utf8::encode is the fastest (safe) option for output.

Just beware that they operate in-place, and may screw up assumptions made in the rest of the code if you didn't create a copy first, or discard the data afterward.

  • Comment on Re^7: FCGI, tied handles and wide characters