We help IT Professionals succeed at work.

accented characters Dvořák not reading from URL QueryString, name gets cut off at Dvo

Medium Priority
85 Views
Last Modified: 2020-02-20
Hello, all.

OK, working with SQL Server 2019, and it works wonderfully with accented characters.
Dvořák Hall
It displays to the page just fine.
However, when I try to read from a URL QueryString, it's not working.
I get
Dvo
Instead of the full name.

I have at the top of my main page.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Response.ContentType = "text/html"
Response.CodePage = 65001
Response.CharSet = "UTF-8"
%>
 

Open in new window


But it still will not get the URL: /Page/Dvořák_Hall
And display it correctly to the page, to use against the database query.

Any suggestions?
Wayne
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:

Only certain characters are allowed in a URL.  You will need to encode them.


The Topic Areas include ASP and the snippet mentioned VBScript.  Are you really using classic ASP?


It has been MANY years since I dealt with classic ASP but you will need to encode the URL string.


In .Net there is a Server.URLEncode Method:

https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525738(v%3Dvs.90)



Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

Commented:

Yes, I am REALLY using ASP Classic.

So, are you telling me that I need to change the way words like this,   Dvořák Hall
Is in a URL? To something else?
I am trying everything I can, to keep my URL's nice and clean looking.

I will look in on the encoding/decoding and see what I can do with it.

Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

Commented:

I just did a test on a website testing tool for encoding, and this is what that name would look like.
From this.
Dvořák Hall
To this.
Dvo%26%23345%3B%E1k_Hall

CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Slightwv pointed out you could look at using urlencode
https://www.w3schools.com/asp/met_urlencode.asp
Author, Web Developer
CERTIFIED EXPERT
Top Expert 2009
Commented:

I have decided to go a different route on this one.

I have changed the URL to this.
Main.asp?Type=Venue&VenueID=5&VName= Dvořák_Hall

In my URL Rewrite, I have this.

Pattern: Venue/([_0-9a-z-(-)-,-]+)/([_0-9a-z-(-)-,-]+)
Rewrite URL: Main.asp?Type=Venue&VenueID={R:1}&VName={R:2}


It works like a charm.
This way, I don't have to worry about what the VName is, or what characters are there.
I am strictly looking at the ID and using that value against my database.

Using the URL encoding method would ruin what I am trying to do, which is to have a very nice and clean site, both on the page itself as well as the URL structure.

CERTIFIED EXPERT
Most Valuable Expert 2012
Distinguished Expert 2019

Commented:

>> which is to have a very nice and clean site, both on the page itself as well as the URL structure.


Not sure why.  What is displayed on the page and what the actual link is can be two different things.

<html>

<body>

<a href="/Page/Dvo%26%23345%3B%E1k_Hall">/Page/Dvořák_Hall</a>
</body>

</html>

Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Author

Commented:

The way it's working now is perfect.
All links that I have seen that deal with encoding have all been messy URLs.
So I have steered away from using encoding unless it was needed.
If I can find a way around using it, then I will do that, which is what I did in this case.
I just added in the ID of the record to be called first in the URL structure, so it is read.

Thank
Wayne