perl-unicode

Re: Encode::Guess fails on UTF-16BE string w/ newline characters

2003-04-15 01:30:04
Dan Kogai <dankogai(_at_)dan(_dot_)co(_dot_)jp> writes:

You mean "open F, '<:encoding(Guess)'" ?  The answer is no because in 
order to guess encoding you have to actually read it.  And to allow 
file access after the guess you have to rewind the filehandle, 
something you can't always do (consider socket).

So long as you can detect the encoding in the 1st buffers-worth
(where your layer gets to decide on buffer size) then with -Duseperlio 
you can rewind a socket. One of the motivations for PerlIO's "unread" 
semantics was for exactly this case.

Now it may not make sense to put logic for that into :encoding itself
so perhaps we need :guessencoding or :via(GuessEncoding) ...

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/