develooper Front page | perl.perl5.porters | Postings from February 2001

RE: The State of The Unicode

From:
Paul Marquess
Date:
February 20, 2001 06:14
Subject:
RE: The State of The Unicode
Message ID:
002401c09b47$34408200$07bdfea9@bfs.phone.com
From: Nick Ing-Simmons [mailto:nik@tiuk.ti.com]

...
> What I didn't tell you is utf8_length() is to be defined thus:
>
> MODULE = Encode, PACKAGE = Encode, PREFIX = Nicks_
>
> IV
> Nicks_utf8_length(sv)
> SV *	sv
> CODE:
> {
>  STRLEN len;
>  (void) SvPV_force(sv,len);  // its a string damn it!
>  sv_utf8_upgrade(sv);        // I want it encoded
>  SvUTF8_on(sv);              // even if there are no high-bits yet,
>  RETVAL = SvCUR(sv);         // now how long is it ...
> }
> OUTPUT:
>  RETVAL

Will there be any impact on legacy .xs code that doesn't know anything about
the new UTF8 SV's? I'm thinking here of modules like Compresss::Zlib.

Hmmm, does this fall under the "if an XS sub expects bytes, it's the
responsibility of the person using the code to give them bytes".

Paul


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About