Link to home
Start Free TrialLog in
Avatar of jayham
jayham

asked on

Issues with french characters

Ok here is what I have
I have content being pulled from a DB
"Gestion des déchets"
I am trying to compare it to a value in the querystring
"Gestion des déchets"
I am assuming they are not equal because of the special character.
I have tried replacing the é with é but it does not seem to find it
test=cstr(request.querystring("subject"))
test=replace(test,"é","é")
 any ideas
SOLUTION
Avatar of jitganguly
jitganguly

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jayham
jayham

ASKER

no luck
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why not use replace function from SQL itself ? So when data comes to you it is already formatted ?

Select replace(test,"é","é")
Here's an idea (a little ugly but it'll work)

Load the string into an xml DOM.  That will parse the string correctly.

Dim s: s = "Gestion des déchets"
Dim s1: s1 = "Gestion des déchets"
Dim s2

Dim dom = Server.CreateObject("MSXML2.DOMDocument")

dom.loadXML("<x>" & s & "</x>")

s2 = dom.documentElement.text

If s1 = s2 Then
  'They are equal
Else
  'No they're not
End If

Of course the serious solution is to stop storing the escape sequences in the DB in the first place.  If its a SQL Server DB then change the field that stores the values to an nvarchar field.  If it's an MDB then it will already be able to store unicode characters.

Anthony.