473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 3793
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matthias Stern | last post by:
Hello! I've got a Javascript-PHP encoding problem. (1) Here is the short version: ============================== I'm sending a form textfield via Javascript(!) as URL parameter (GET)...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
1
by: Slade | last post by:
Hi, I'm trying to use POST an image to a web page with WebRequest/WebResponse. Only problem is that I must be making an error somewhere in the encoding/decoding process. I've pasted below a bit...
9
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the...
5
by: Peter Jansson | last post by:
Hello group, The following code is an attempt to perform URL-decoding of URL-encoded string. Note that std::istringstream is used within the switch, within the loop. Three main issues have been...
25
by: marcin.rzeznicki | last post by:
Hello everyone I've got a little problem with choosing the best decoding strategy for some nasty problem. I have to deal with very large files wich contain text encoded with various encodings....
1
by: MC | last post by:
Hi! On win-XP (french), when I read subprocess (stdout), I must use differents decoding (cp1252,cp850,cp437, or no decoding), depending of the "launch mode" of the same Python's script: - from...
9
by: KWSW | last post by:
Having settled the huffman encoding/decoding and channel modeling(thanks to the previous part on bitwise operation), the last part would be hamming encoding/decoding. Did some research as usual on...
0
by: Michele | last post by:
Hi there, I'm using a python script in conjunction with a JPype, to run java classes. So, here's the code: from jpype import * import os import random import math import sys
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.