Sign in to follow this  
Followers 0

How can I convert some words into UTF-8

4 posts in this topic

#1 ·  Posted (edited)

hi all, i have to encode some Chinese/Japanese words to the UTF-8 format in order to do a post action in IE, just like when we search a word "非常" (a chinese words means "very") in google, the browser will convert it to UTF-8 charactor "%E9%9D%9E%E5%B8%B8" and send it as a post data to the server. and in my case, i want to post some data to the page (i'm making a online chinese/japanese translator for my girl friend :"> ), and then i'll receive a page contained the info i need. after analyzing the page, i could get the translated words. but the post data must be UTF-8, i don't know how to convert my words to that format, could anyone can any suggestion?

i have searched this forum, and there's a topic about this, it contain these codes:

Func URLEscape($text)
    For $x=1 To StringLen($text)
        If StringRegExp($char,'\A|\.',0) Then
    Return $newtext

in my test, if i input the english charctor, it works ok. but when i input the chinese charctor, this function's return value with GBK format instead of UTF-8.


Edited by Cappuccino

Share this post

Link to post
Share on other sites

i have got a VBS to convert the charctor. it is below,

Function chinese2unicode(Str) 
  dim i 
  dim Str_one 
  dim Str_unicode 
  for i=1 to len(Str) 
    Str_unicode=Str_unicode& Hex(ascw(Str_one)) 
  WScript.Echo Str_unicode
end function

but the return value of a word "非常" is "非常", not the value "%E9%9D%9E%E5%B8%B8" i mentioned. can any help? :whistle:

Share this post

Link to post
Share on other sites

Can any body give help?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0