• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

vbscript language conversions

D

Dean g

#1
hi,
I have a webpage that accepts posts in another language, when i insert
this post into my sql server database it automatically converts it to
the form ฒൈ etc...

This is fine as the browser then converts it back into the language. My
problem is i am now importing text in that language straight into the
database from an excell file. so i now i need to convert the language to
the same format using vb. I have tried acsii and unicode but cant seem
to get it in the same format of ฒ where it can be read by the
browser.

sorry if this doesnt quite fit the vbcript category i wasnt sure where i
should post it.

I'm getting desperate any help on this would be great.
Regards,
Dean



*** Sent via Developersdex http://www.developersdex.com ***
 
A

Anthony Jones

#2
"Dean g" <big_deanus@xxxxxx> wrote in message
news:edXQ9RE$IHA.1224@xxxxxx

> hi,
> I have a webpage that accepts posts in another language, when i insert
> this post into my sql server database it automatically converts it to
> the form ฒൈ etc...
>
> This is fine as the browser then converts it back into the language. My
> problem is i am now importing text in that language straight into the
> database from an excell file. so i now i need to convert the language to
> the same format using vb. I have tried acsii and unicode but cant seem
> to get it in the same format of ฒ where it can be read by the
> browser.
>
> sorry if this doesnt quite fit the vbcript category i wasnt sure where i
> should post it.
>
Show us some code you have tried? How close have you got.

Bad air code follows but is the general principle needed:-

output = ""
For i = 1 to Len(s)
charCode = AscW(Mid(s, i, 1))
If charCode > 127 Then
output = output & "&#" & charcode & ";"
else
output = Mid(s, i, 1)
End If
Next

Is there any way you stop storing the data like this, its not a good design
choice to pollute persisted data with encodings for specific transport or
presentation technologies. What if you wanted at some point to use a server
side report generation tool that creates a PDF for example?


--
Anthony Jones - MVP ASP/ASP.NET