From:             lunter at interia dot pl
Operating system: all
PHP version:      6CVS-2009-01-08 (snap)
PHP Bug Type:     Unicode Engine related
Bug description:  converting binary<->string without charset translating

Description:
------------
converting binary<->string without charset translating


Two functions for converting binary<->string without translating charset
needed.
It is very usefull because binary data can consists utf-8 substring, you
need to convert to string type.
Also when you have to see binary representation of utf-8 string, or
operating on it as binaries.


Example 1:

You have (binary)$b. It consists two bytes: 11001110 10110010
Its length in binary representation is two.
It is also valid one-length UTF-8 char(946) (greek small letter beta)
How to conver it ($b) into one-char UTF-8 string??
When we try $u=(string)$b, it gives two-char UTF-8 string.


Example 2:

You have (string)$u UTF-8 one-char string. It consists chr(946) (greek
small letter beta)
Now You have to see two bytes binary representation of this (11001110
10110010).
There is no way to convert it without charset translation...




Reproduce code:
---------------
;;;;;;;;;;;;;;;;;;;;
; Unicode settings ;
;;;;;;;;;;;;;;;;;;;;

unicode.semantics = off
unicode.runtime_encoding = iso-8859-1
unicode.script_encoding = utf-8
unicode.output_encoding = utf-8
unicode.from_error_mode = U_INVALID_SUBSTITUTE
unicode.from_error_subst_char = 3f




Expected result:
----------------
way to converting binary<->string without charset translating



Actual result:
--------------
no way to converting binary<->string without charset translating




-- 
Edit bug report at http://bugs.php.net/?id=47033&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47033&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47033&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47033&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47033&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47033&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47033&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47033&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47033&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47033&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47033&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47033&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47033&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47033&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47033&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47033&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47033&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47033&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47033&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47033&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47033&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47033&r=mysqlcfg

Reply via email to