How can my lower level routine know what format the stream is in (binary or unicode-text), so if the stream is in unicode, it can output unicode chars as '>8-bit values', OR if it is in 'binary', it can encode such values as UTF-8 so perl will see the stream as binary (and not complain about 'wide chars in output' -- and then do the conversion for me -- which seems to be it's current behavior).
I.e. If my lower level routine is about to print 'pi' in unicode, and the stream is a unicode stream, I'd print "\x{3c0}", but if it is a binary stream, I'd print "\xcf\x80" so the output would show 'π' in either case, w/o warnings.
I don't see a documented way of determining the current mode of a stream -- I need a "query-format" of the binmode directive so my 'blind' subroutine can _try_ to generate correct output in the face of unknown or random (user-based) input.
Thanks! ;-)
In reply to How to tell if a stream is already in UTF8 mode? by perl-diddler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |