469,963 Members | 1,858 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

URL decoding/encoding problem

URL decoding/encoding problem
Iif the url contains chinese char,the url will be encoded.
For example :
url:http://194.0.0.84/中文页面.htm
when my tdi driver intercept the packet, I find that "中文页面.htm"

has been encoded to "%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"
when I decode it with utf8 ,the content still is not decoded;
My codes as follow:
char szMySer[MAX_PATH] ={"%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"};

char *strTem =utf8_gb(szMySer);
AfxMessageBox(strTem);
strTem ="%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm";
utf8_gb is used to decode string with utf8,it is a very correct fuction

I have used many times.
what's wrong with my code? or Do you have any good idea?
thanks.

Nov 23 '06 #1
4 3601
In article <11*********************@j44g2000cwa.googlegroups. com>,
flyingco <zh*********@gmail.comwrote:
>has been encoded to "%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"
when I decode it with utf8 ,the content still is not decoded;
You first have to replace each %NN with the byte value it represents
in hexadecimal, *then* interpret that sequence of bytes as UTF-8.

See RFC3986.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 23 '06 #2
"flyingco" <zh*********@gmail.comwrote:
# URL decoding/encoding problem
# Iif the url contains chinese char,the url will be encoded.
# For example :
# url:http://194.0.0.84/=D6=D0=CE=C4=D2=B3=C3=E6.htm
# when my tdi driver intercept the packet, I find that "=D6=D0=CE=C4=D2=B3=C3=
# =E6.htm"

Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: quoted-printable

It would help if you posted plain ASCII instead of
encoded quoted printable: at the moment it's not clear
what the equal signs stand for, what is encoded in your
post and what is not.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
I ASSURE YOU WE'RE OPEN!
Nov 23 '06 #3
On 23 Nov 2006 03:22:49 -0800, "flyingco" <zh*********@gmail.com>
wrote in comp.lang.c:
URL decoding/encoding problem
Iif the url contains chinese char,the url will be encoded.
For example :
url:http://194.0.0.84/中文页面.htm
when my tdi driver intercept the packet, I find that "中文页面.htm"

has been encoded to "%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"
when I decode it with utf8 ,the content still is not decoded;
My codes as follow:
char szMySer[MAX_PATH] ={"%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"};

char *strTem =utf8_gb(szMySer);
AfxMessageBox(strTem);
strTem ="%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm";
utf8_gb is used to decode string with utf8,it is a very correct fuction

I have used many times.
what's wrong with my code? or Do you have any good idea?
thanks.
We have no idea what the utf8_gb() function is, or what is it supposed
to do. So we have no idea what you are doing wrong.

You need to ask in a group that supports this function, or perhaps one
like news:comp.os.mswindows.programmer.win32.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 24 '06 #4
thanks you very much!
utf8_gb() is a function which is used to decode the string encoded by
utf8.
utf8_gb() is a correct function I have used many times.
I am thinks about this question for this time.
"Jack Klein 鍐欓亾锛
"
On 23 Nov 2006 03:22:49 -0800, "flyingco" <zh*********@gmail.com>
wrote in comp.lang.c:
URL decoding/encoding problem
Iif the url contains chinese char,the url will be encoded.
For example :
url:http://194.0.0.84/脰脨脦脛脪鲁脙忙.htm
when my tdi driver intercept the packet, I find that "脰脨脦脛脪鲁脙忙.htm"

has been encoded to "%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"
when I decode it with utf8 ,the content still is not decoded;
My codes as follow:
char szMySer[MAX_PATH] ={"%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm"};

char *strTem =utf8_gb(szMySer);
AfxMessageBox(strTem);
strTem ="%E4%B8%AD%E6%96%87%E9%A1%B5%E9%9D%A2.htm";
utf8_gb is used to decode string with utf8,it is a very correct fuction

I have used many times.
what's wrong with my code? or Do you have any good idea?
thanks.

We have no idea what the utf8_gb() function is, or what is it supposed
to do. So we have no idea what you are doing wrong.

You need to ask in a group that supports this function, or perhaps one
like news:comp.os.mswindows.programmer.win32.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 27 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Matthias Stern | last post: by
1 post views Thread by Slade | last post: by
9 posts views Thread by Mark | last post: by
5 posts views Thread by Peter Jansson | last post: by
25 posts views Thread by marcin.rzeznicki | last post: by
1 post views Thread by MC | last post: by
9 posts views Thread by KWSW | last post: by
reply views Thread by Michele | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.