URL decoding/encoding problem

F

flyingco

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.
 
R

Richard Tobin

flyingco said:
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
 
S

SM Ryan

# 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.
 
J

Jack Klein

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
 
F

flyingco

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 写é“:
"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top