Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert swedish letters in URL's using Classic ASP?

Status
Not open for further replies.

krabban

Programmer
Oct 18, 2003
131
0
0
SE
I have a CMS where users enter some information and also address to the personal website. It's been working great for years... until a person recently entered an URL containing swedish characters.

The Domain Converter really point out the problem:

***
The deal is, I'm not sending users (on the public site) directly to the URL, there is also a counter. So... the link to the URL is like this:

redirect.asp?intURL=123

and then ... some database fiddle... and then redirect:

response.redirect [URL in database]

****
This is working when no Swedish characters are involved. How to solve this??
 
Thank you for reply!!
With BIG enthusiasm, I tried all as I could think of from this page, the link. URLEncode as well as HTMLEncode in all sorts of different manners.

Unfortunately, I was never able to do successfully...

I must be missing something!?

***
My code is little more complex than I stated earlier:

redirect.asp?strURL=123

----
Code:
<!-- #INCLUDE VIRTUAL="/admin/open.asp" -->
<%
myVar = request("strURL")
IF myVar <> "" THEN ...
- Add a click to the counter
- Find the URL and put in variable, returnPath
END IF
[then there are some other alternatives, to download the file for example.]

%>

<!-- #INCLUDE VIRTUAL="/admin/close.asp" -->
<%
IF request("strURL") <> "" THEN
	response.redirect Server.HTMLEncode(returnPath)
ELSE
	response.redirect returnPath
END IF
%>
 
Try with URLEncode instead.

Here is an interesting read on the topic: UrlEncode vs. HtmlEncode




[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Thank you for the answer!
I think you read the code but not the post... I've tried with URLEncode as well.

I think I need to convert the URL to punycode before using the response redirect. I've looked for this... but my time is up for today.

I'll think of something.
Thank you!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top