Solved

Inputting Greek in a simple input form to SQL DB

Posted on 2004-10-22
763 Views
Last Modified: 2012-05-05
Hello there experts,

This must be a rather simple question, but I need your help:

I have an intranet website that collects different languages such as English, Portugese, Italian, French, Japanese etc. The first languages I all handle with Unicode, the last with SHIFT_JIS.

However, now that we want to add Greek to it, I'm seeing problems not with the display side of things, but with getting form input to our SQL database. Let me explain:

Whenever I type Greek data using the built-in Windows Language Bar (http://support.microsoft.com/default.aspx?scid=kb;en-us;306993&sd=tech) DIRECTLY into SQL, the data is saved normally and displays fine when fetched in ASP. However, when I do the same thing and type the data in a web form first (displays fine) the data doesn't get saved in SQL proper.

Strangest thing is that our web applications are working fine for all those other languages...

This is the code I used for setting our web apps to Unicode:
strCharset = "UTF-8"
Response.Charset = "utf-8"
Session.Codepage = 65001
.......
<META http-equiv=Content-Type content="text/html; charset=<%= strCharset %>">

So this is what I did for Greek (since as with Japanese input, Unicode didn't work):
strCharset = "iso-8859-7"
Response.Charset = "iso-8859-7"
Session.Codepage = 1253
........
<META http-equiv=Content-Type content="text/html; charset=<%= strCharset %>">

Am I using the wrong charset or codepage here? Please advise!

Thanks,
Victor
0
Question by:vpikula
    5 Comments
     

    Author Comment

    by:vpikula
    Anyone??

    Victor
    0
     
    LVL 2

    Expert Comment

    by:seloh
    I believe the problem lies in http, the form sends the data to the next page as ascii which doesn't support the greek alphabet.
    My best bet is to create a javascript that converts the greek letters into ascii before sending them to the next page!

    http://www.alanwood.net/unicode/greek.html
    0
     

    Author Comment

    by:vpikula
    That's a good point -- So I need to convert the form data to html codes first? Do you have a good function for that? (seems quite manual...)
    0
     
    LVL 2

    Accepted Solution

    by:
    It would be something like this in ASP:
    <%
      Function translate(string)
        convertor = "&#945;@&alpha;|&#946;@&beta;|.....etc"
        convertor = split(convertor, "|")

        loops = UBound(split(convertor, "|"))

        FOR i=0 TO loops
          loopy = split(convertor(i), "@")
          string = replace(string, loopy(0), loopy(1))
        NEXT
      End Function
    %>
    This function has to be preformed before you send it though!
    0
     

    Author Comment

    by:vpikula
    Hmmm yes that will do for converting it from Unicode to HTML codes I guess -- will give that a go and award you the points nonetheless, closing this old topic.

    Many thanks,
    Victor
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    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…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    913 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

    17 Experts available now in Live!

    Get 1:1 Help Now