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.querystr ing("subje ct"))
test=replace(test,"é"," 33;")
any ideas
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.querystr
test=replace(test,"é","
any ideas
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not use replace function from SQL itself ? So when data comes to you it is already formatted ?
Select replace(test,"é","é")
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("MSXML 2.DOMDocum ent")
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.
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("MSXML
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.
ASKER