ID: 27864 Updated by: [EMAIL PROTECTED] Reported By: rick at revenew dot nl -Status: Open +Status: Feedback Bug Type: Feature/Change Request Operating System: Linux (Redhat 7.1/Debian Woody) PHP Version: 4.3.5 New Comment:
What's wrong with the chr() function? Previous Comments: ------------------------------------------------------------------------ [2004-04-05 04:08:34] rick at revenew dot nl BTW, I'm running into this problem while parsing html unicode strings like Δ to unicode characters in PDFlib. The following section in the PDFlib manual describes the exact same problem (I think :) )with a resolution for the C++ binding of PDFlib: Unicode in the C++ language binding. C++ users must be aware of a pitfall related to the compiler automatically converting literal strings to the C++ string type which is expected by the PDFlib API functions: this conversion supports embedded null characters only if an explicit length parameter is supplied. For example, the following will not work since the string will be truncated at the first null character: p.show("\x00\x41\x96\x7B\x8C\xEA"); // Wrong! To fix this problem apply the string constructor with an explicit length parameter: p.show(string("\x00\x41\x96\x7B\x8C\xEA", 6)); // Correct ------------------------------------------------------------------------ [2004-04-05 04:02:11] rick at revenew dot nl Description: ------------ Let's say I have a variable $var which contains 94. Now I want to create the escaped character \x94 from this var. This seems to be impossible. I've tried all kinds different approaches. Simply concatenating two strings (single or double quoted). escaping the \x with \ sprintf()'ing etc. It seems like it's impossible to create the escaped character from 2 (or more) parts. At the moment I'm using a dirty fix to overcome this problem: I have an array like this: array( "\\x00"=>"\x00", "\\x01"=>"\x01", "\\x02"=>"\x02", "\\x03"=>"\x03", etc.. ) with this aray you can perform a strtr(); Which works around the problem. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27864&edit=1