Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Corrupted Display with UTF-8 characters and MSSQL database

Posted on 2006-07-16
2
Medium Priority
?
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
slamhound earned 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 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