Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    11

    Unanswered: Problem In Codepage 65001

    i have a problem with unicode utf-8 code page

  2. #2
    Join Date
    Feb 2002
    Location
    San Francisco, CA
    Posts
    441
    What problem?

  3. #3
    Join Date
    Apr 2004
    Posts
    11

    Question About Problem in ASp Page Using CODEPAGE=65001

    Hi Thank You for Your Reply
    My Problem IS That I Have A Web Site That Insert Some Data From Html Form In A Online WebSite My DB IS SQLSERVER And I Was Create DB And Set
    Such A Properies To DB My Collation Is Arabic_CI_AS Because I Am Going to
    Insert Farsi Or Arabic Data And Table rows is Using nChar And NVarchar And NText .
    Other Things That My Windows Local Is Farsi And Sqlserver(In Local And Not Remote Machine Is Arabic)
    In the Web Pages I Am Using Both<%@ CODEPAGE="65001"> Directive And Charset="utf-8" In Meta Tag .
    But I am Encountered Such A Problem In Data Insertion :
    _____________________________1____________________ ______________
    1>>When I Use The <%@ CODEPAGE="65001"> In Both Of ASP Page(Form And Insert Page) The Data IS Inserted Like '??????' And Displayed In Web Page Like '??????' Anf Data Displayed In Query Analyzer Same AS WEB Pages
    And Like('???????')
    _____________________________2____________________ ______________
    2>>When I Use The <%@ CODEPAGE="65001"> In first Page(form) And Remove This Directive In Next Pge The Data Is Displayed COrrect In Web Pages But I Cant See It Direct From Query Analyzer And Enterprise Manager ) But Data Is Not Displayed Like First Manner It Is Like A State That Code Page IS Not Correct.
    _________________________ASP PAGE CODE__________________________
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
    <html>
    <head>
    <title>Insert</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>

    <body>
    <form lang="fa" dir="rtl" action="ins.asp" method="post">

    <input dir="rtl" lang="fa" name="name" type="text"><br>
    <input dir="rtl" lang="fa" name="family" type="text"><br>
    <input type="submit" value="insert">
    </form>
    </body>
    </html>
    ******************** Insertion Page***************************
    <%@LANGUAGE="JAVASCRIPT" %>

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>insert</title>
    </head>

    <body>
    <%/* CODEPAGE="65001" */
    var con=Server.CreateObject('adodb.connection');
    var rs=Server.CreateObject('ADODB.Recordset');
    con.open("Driver={sql server};server=server; Database=mydb; uid=*****; pwd=******");
    var n=Request.Form('name');
    var f=Request.Form('family');
    Response.Write(Request.Form("name")+'<br>');
    Response.Write(Request.Form("family")+'<br>');

    var sql="insert into smpl(name,family) values('"+n+"','"+f+"')";
    Response.Write(sql);
    con.Execute(sql);
    rs.Open("select * from smpl where name='محمد مهدي' ",con);

    Response.Write("<table border=1><tr><td>The Test Data List</td></tr>");
    while(!rs.EOF)
    {
    Response.Write('<tr><td>'+rs("name")+'</td><td>'+rs("family")+'</td></tr>');
    rs.MoveNext();
    }
    con.Close();
    Response.Write("</table>");
    %>
    </body>
    </html>

  4. #4
    Join Date
    May 2004
    Location
    Tel Aviv / Israel
    Posts
    1

    This is a common problem for all non-latin languages

    This is your original query:

    Code:
    var sql="insert into smpl(name,family) values('"+n+"','"+f+"')";
    Response.Write(sql);
    con.Execute(sql);
    rs.Open("select * from smpl where name='محمد مهدي' ",con);
    It should look like this:

    Code:
    var sql="insert into smpl(name,family) values(N'"+n+"', N'"+f+"')";
    Response.Write(sql);
    con.Execute(sql);
    rs.Open("select * from smpl where name=N'محمد مهدي' ",con);
    The N prefix sets the field to accept unicode, instead of the local character set of the remote machine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •