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

Using Windows message as a Handle
Hi,

I am writing one of my first multithreaded programs.

In one of the thread,

Problem in back link
I have page where i have given javascript back link but when i click on it browser give a message

Syntax Help
Code:


im having trouble with that code snipped
Parse error: syntax error, unexpec

Can't shake the "Warning: include()" error
I've just uploaded my site to a new server and where I have PHP include tags in my HTML, the browser

PHP and MySQL Question/Help
I have a MySQL db with all my servers and all their details like server name, IP, OS, RAM etc etc 26

Redirect not working after making a POST/GET
Hi Everyone,

I am a novice in PHP. Here I have 2 pages, one page with a textbox and button an

Query output more than expected
$query=mysql_query("SELECT * FROM players, communities, divisions WHERE dob BETWEEN '{$start_da

PHP Function Page Advice
Hi All, I am quite new to PHP and Javascript but have written an Online Shop (Mainly for Fun and edu

How to store checkbox array in a session, and then be able to add to it?
I'm trying to store an array of checkbox values into a session array, sort of like a shopping cart,

Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don

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