Solved

Corrupted Display with UTF-8 characters and MSSQL database

Posted on 2006-07-16
2
342 Views
Last Modified: 2013-12-03
I have developed a website for a client that uses an MSSQL database to store the page data.  I have done this many times in the past without problem, but for this client, I am not having success.

The english pages render without any problems.  But he now has translated his site into hebrew, which we have encoded (hopefully) using UTF-8, and the information is not displaying at all.  Instead we see question marks on the screen.  As if that wasn't bad enough, we actually sometimes see the information correctly on the screen (perhaps after we rebooted, or something else, but both me and my client have successfully seen the pages rendered correctly without modifying the data or the website at least once).

An example of this can be found here:
http://www.nlpjerusalem.com/index.asp?lang=HE

Along the top row are all the menu choices.  The one or two that display in proper hebrew characters are due to the fact that they were entered as ESCape characters (e.g. &# and the the number, such as 1510 and a ;).

I am currently developing in MS Expression Web Designer (beta), but I can't think of how that could have an effect on the information.

I've checked the database, and everything is perfect there. I use an online editor to edit the data, but can also view it in MS Access 2000.

Any ideas how to solve this. I'm going crazy (as is my client) and I can't think of a solution.

Thank you for any solutions you can come up with.
0
Comment
Question by:Lev Seltzer
2 Comments
 
LVL 10

Accepted Solution

by:
slamhound earned 500 total points
ID: 17120003
You can use the server.encode command that will render the unicode characters into the HTML &#150 style.

On the other hand, you can use this procedure that will do the same thing but give you a bit more control:

Public Function c2u(CnText)
      For zzzz = 1 to Len(CnText)
        c = Mid(CnText, zzzz, 1)
        if ascw(c) > 192 then '  and ascw(c) < 33
           c2u = c2u & "&#x" & Hex(AscW(c)) & ";"
        else
           c2u = c2u & c
        end if
     Next
   End Function

Also, make sure your ASP code starts with:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

And that you have this at the beginning of your HTML pages:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
0
 

Author Comment

by:Lev Seltzer
ID: 17120441
Your function was interesting,but the line:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
was what was (apparently) needed to correct the situation. I put it on my pages, and then instantly began working.  I tried another computer, and I tried in Firefox, and everything is perfect.

Thank you for the quick response!  you've saved the day.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now