perl-unicode

Re: issues with unpack function

2003-04-02 08:30:04

prateep_korsapati(_at_)in2(_dot_)exch(_dot_)hp(_dot_)com said:
unpack('U*', $string) This expression is resulting in a null string if
the string does not have any unicode characters.. How to avoid this
situation.. 

If $string does not contain any unicode characters, what would you
expect/want "unpack('U*',$string)" to return?  It seems to me that a
null string would be the appropriate return value.  (Though maybe it 
would be handy to have some global status variable, like $@, to check 
for errors/failures.)

What situation do you actually want to avoid?  Do you need a way to test
whether $string contains unicode data before passing it to unpack?  Or
do you want unpack(U*,...) to do something other than return a null
string when you hand it non-unicode data?

        Dave Graff


<Prev in Thread] Current Thread [Next in Thread>