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

How to generate a random array of integers subject to a certain constraint
I am writing a program that asks the user to enter an integer N and then generates a random array of

Web Host List
Here is a list of web hosts that offer PHP and MySQL. It is no where near a full list, but it is mos

mail()
Hi all. I have a problem with emails. I am trying to set up a mail system where customers can subscr

User input in to variable
Hi all,

I'm sure this is very easy but I'm having another brain freeze!

At the end of

distinct rows
Hi
version 10.2.0.3

I have a query output something like the following

ID

PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a

Access database inside of a validation class
Hello,

For quite some time, I have been using functions to validate form input and access the

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming

This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the

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