PHP 6 and non-unicode strings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yawnmoth

    #1

    PHP 6 and non-unicode strings

    I have a library that does appends characters to strings (eg. $var.=
    chr(45)) and then unpacks them (eg. unpack('N4'), or whatever).

    Since PHP 6, however, uses unicode strings, I'm kinda worried that PHP
    6 might break my program. Since I am needing to manipulate strings on
    a byte level as opposed to a character level, I don't want $var[4] to
    return a two byte character - I want it to return a single byte
    character.

    My question is... what can I do to fix this?

    I'd rather not do something like ini_set because, although the
    library, itself, may use byte strings, the script including the
    library might not.

    Any ideas?
  • Sjoerd

    #2
    Re: PHP 6 and non-unicode strings

    On 6 aug, 21:11, yawnmoth <terra1...@yaho o.comwrote:
    I am needing to manipulate strings on
    a byte level as opposed to a character level
    My guess is that there is a native Unicode string type, for human-
    readable text, and a distinct binary string type, for applications
    such as yours. Presumably, fread('bla', 'rb') would return the binary
    type (because of the 'b'), or you may cast it to the right type.


    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.

    Comment

    Working...