473,587 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need some help on unicode... thanx...

Hi, i need some help on this urgently... Thanx.... The situation is
like this, i need to find out the way to convert Chinese characters
into hexa code. but the problem is what i got from bin2hex() is not
giving the desired output. below is the sample of what i want:

input : 新聞首*
output: 65B0805E9996980 1 (this is the output from some converter for
non english language UCS)
output: %e6%96%b0%e8%81 %9e%e9%a6%96%e9 %a0%81 (this is the output from
the same converter for url encoded)
for the converter which i did myself i got something like this.
input: 新聞首*
output: e696b0e8819ee9a 696e9a081 (this is from php bin2hex() )
output: %E6%96%B0%E8%81 %9E%E9%A6%96%E9 %A0%81 (this is from php
urlencode() )
Can anyone tell me what is the correct way to get the output for non
english language UCS ( output: 65B0805E9996980 1)? as what i know the
converter was done by asp, but i need php now. thanx...

regards,
Justin

May 8 '06 #1
4 1640

Justin wrote:
Hi, i need some help on this urgently... Thanx.... The situation is
like this, i need to find out the way to convert Chinese characters
into hexa code. but the problem is what i got from bin2hex() is not
giving the desired output. below is the sample of what i want:

input : 新聞首*
output: 65B0805E9996980 1 (this is the output from some converter for
non english language UCS)
output: %e6%96%b0%e8%81 %9e%e9%a6%96%e9 %a0%81 (this is the output from
the same converter for url encoded)
for the converter which i did myself i got something like this.
input: 新聞首*
output: e696b0e8819ee9a 696e9a081 (this is from php bin2hex() )
output: %E6%96%B0%E8%81 %9E%E9%A6%96%E9 %A0%81 (this is from php
urlencode() )


urlencode() seems to be working then? The output is the same as the ASP
version, except for the fact that it's capitalised.

May 8 '06 #2

Justin wrote:
Hi, i need some help on this urgently... Thanx.... The situation is
like this, i need to find out the way to convert Chinese characters
into hexa code. but the problem is what i got from bin2hex() is not
giving the desired output. below is the sample of what i want:

input : 新聞首*
output: 65B0805E9996980 1 (this is the output from some converter for
non english language UCS)
output: %e6%96%b0%e8%81 %9e%e9%a6%96%e9 %a0%81 (this is the output from
the same converter for url encoded)
for the converter which i did myself i got something like this.
input: 新聞首*
output: e696b0e8819ee9a 696e9a081 (this is from php bin2hex() )
output: %E6%96%B0%E8%81 %9E%E9%A6%96%E9 %A0%81 (this is from php
urlencode() )
Can anyone tell me what is the correct way to get the output for non
english language UCS ( output: 65B0805E9996980 1)? as what i know the
converter was done by asp, but i need php now. thanx...

regards,
Justin


What you need is $a = unpack('H*hex', $s); echo $a['hex']; I believe.
See the manual entry for unpack() for more info.

May 8 '06 #3
you should try the code below, it might be the one you looking
for......
hope this can help you

$a=mb_convert_e ncoding($str,"U CS-2","UTF-8");
$b=bin2hex($a);

May 13 '06 #4
THANx stam.... i manage to get the desired output! thanx treefrog and
chungleong for ur kindness too!

May 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2974
by: phil | last post by:
I can't find, anyone know the unicode symbol CONGRUENT. either tilde over equal or triple tidde would do. Thanks.
10
1911
by: Dan | last post by:
Hi all, I'd like to submit what it seems to be a bug as for the Unicode compliance of methods like Char.Is...: as stated by the latest version of Unicode, codes +03F2 and +03F9 represent Greek lunate sigma, lowercase and uppercase respectively (c and C). For these codes I get the following results: +03F2: lowercase c: Char.IsLetter() =...
1
1535
by: aarthy | last post by:
Hi, I have a problem in the display of the ASP screen actually i am retrieving and displaying the data from a database when the view button is hit.The contents for display is so long so i want to have a previous, next link on that page so that some 100 records are displayed in each page.Pls help me. Thanks for your reply.
4
1298
by: gorostas | last post by:
Helo everyone! I'm making some little app whitch will help me to get things automated,,,im in the need very often to make some little changes to some files, and something like this: dim string1 dim string2 dim temp
3
4404
by: Erwin Brandstetter | last post by:
Created a new 7.4 database. # create database foo with encoding = UNICODE; Then tried to restore my dump from pg 7.2 which was SQL-ASCII or Latin1 encoded (cant tell which of the two, only got the dump of the old database left after upgrading postgresql.) Succeeded creating the objects, but no data was restored, instead postgresql complained...
4
1943
by: David Siroky | last post by:
Hi! I need to enlighten myself in Python unicode speed and implementation. My platform is AMD Athlon@1300 (x86-32), Debian, Python 2.4. First a simple example (and time results): x = "a"*50000000 real 0m0.195s
4
3478
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if substrings need be replaced, or one character needs be changed, what shall I do? Is it better to convert strings to UCS-32 before manipulation? But...
40
3194
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages, including asian languages (chinese, japanese, korean, etc). First of all, strings will be passed to my class methods, some of which based on the...
2
2794
by: Frantic | last post by:
I'm working on a list of japaneese entities that contain the entity, the unicode hexadecimal code and the xml/sgml entity used for that entity. A unicode document is read into the program, then the program sorts out every doublet and the hexadecimal unicode code is extracted, but I dont know a way to find the xml or sgml-entity equivalent to...
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.