How to convert Windows-1255 To UTF-8 in Classic ASP?

与世无争的帅哥 提交于 2019-12-11 01:55:59

问题


How can I convert a windows-1255 string to utf-8 in classic ASP? My database is windows-1255 and I want to transfer my site to utf-8.


回答1:


Does the code in this answer do what you need?




回答2:


Are you sure you need to do any conversion. Whilst your database may store the string in a particular encoding, ordinarily ADODB/OLEDB will deliver the string to VBScript/JScript running in a ASP page as unicode (since actually the script languages only support unicode its actually possible to have any other encoding).

Hence if your output needs to be UTF-8 you need to do this:-

 Response.Codepage = 65001 '' // or have a @codepage directive at the top of the page
 Response.CharSet = "UTF-8"
 Response.Write sMyStringFromTheDatabase

If this doesn't appear to work for you then I suspect you've fallen foul of the Gotcha I describe in my answer that Codebender has linked to.



来源:https://stackoverflow.com/questions/1127837/how-to-convert-windows-1255-to-utf-8-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!