Can't get the unicode character


Posted on 16th Feb 2014 07:03 pm by admin

I'm trying to get some text from various parts of a file. I have converted the file to hex (bin2hex) and I've got this:

64 72 e6 62 65 72 (without spaces)

I'm converting that back by:

Code: <?php
function hex2bin($h)
{
if (!is_string($h)) return null;
$r='';
for ($a=0; $a<strlen($h); $a+=2)
$r .= chr(hexdec($h{$a}.$h{($a+1)}));

return $r;
}
?>

It works fine, except for unicode characters. For example, the above hex is giving me:

dr�ber

While it must be:

dræber

How can I get the correct word?
Thanks

No comments posted yet

Your Answer:

Login to answer
219 Like 34 Dislike
Previous forums Next forums
Other forums

HELP with mysql_real_escape_string
I'm looking to remove apostrophes completely when someone enters lyrics but don't have a clue how to

Performance impact of cookies
Hi, I was just wondering what impact there would be in terms of performance if you where to set then

CE 7.1 and External GIS integration
Hi All,

We want to develop an application on CE 7.1 which uses GIS features from an exter

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

Accept only alpha characters
I've got this bit of code ready for accepting a phrase:

Code: if (!eregi ("", $_POS

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Parse multirow HTML table
Hello all,
I have a site I am working on. Its a sports site and I am trying to add stats to a DB

Rand() help needed
Hi all,

Can someone explain and give me a quick example of how I would go about this?

error reporting
hey everyone

I have a production server in which I want error reporting but only on some page

Revoking alter any table from a schema
Hi All,

i am working in Oracle 10g.
my requirement is to revoke all kind of DDL oper

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash