Professional Web Applications Themes

Code Page - ASP Database

I read text files in ASP on server side, then try to enter data into a database in SQL Server. The files are in ibm852 (1250) coding - at least that's the code page with which they are shown properly when putting the lines read on the output. However, when I enter them into the SQL Server (currently simply by setting a string to an "INSERT INTO T1(6, 'hello')"-like statement and then execute it through the connection such as oConn.Execute sSQL), the special characters (Hungarian) are all changed to meaningless characters, such as 'hell:' for 'helló' etc. The texty columns ...

  1. #1

    Default Code Page

    I read text files in ASP on server side, then try to enter data into a
    database in SQL Server. The files are in ibm852 (1250) coding - at least
    that's the code page with which they are shown properly when putting the
    lines read on the output.

    However, when I enter them into the SQL Server (currently simply by setting
    a string to an "INSERT INTO T1(6, 'hello')"-like statement and then execute
    it through the connection such as oConn.Execute sSQL), the special
    characters (Hungarian) are all changed to meaningless characters, such as
    'hell:' for 'helló' etc.
    The texty columns are of type varchar(n). I also tried nvarchar, but nothing
    has changed.

    So, how can I set the appropriate code page in SQL Server or transform the
    strings so that the special characters don't get messed up when entered?


    Agoston Guest

  2. #2

    Default Re: Code Page

    Agoston,

    Try changing the column type to nvarchar(n) and executing this query:

    INSERT INTO T1(6, N'helló')

    Perhaps you simply forgot to type the N required to signify a Unicode
    string.

    Steve Kass
    Drew University

    Agoston Bejo wrote:
     
    Steve Guest

  3. #3

    Default Re: Code Page


    "Steve Kass" <edu> wrote in message
    news:%phx.gbl... 


    It doesn't change a thing. The same messy characters are in the db. Any
    other ideas?


     [/ref]
    setting [/ref]
    execute [/ref]
    nothing [/ref]
    the [/ref]


    Agoston Guest

  4. #4

    Default Re: Code Page

    I don't do ASP programming, but is the string "INSERT INTO T1 ..." a
    Unicode string? If not, it will not preserve the accented characters.
    There ought to be some way to specify that it be Unicode, similar to the
    way you do in SQL Server with the N prefix. If that fails to produce
    the right result, I'm not sure what could be happening, since Unicode
    strings shouldn't be affected by code page settings, but I'd probably
    try specifying the 1250 code page somewhere on the ASP page - maybe the
    ASP programmers have a better idea.

    SK

    Agoston Bejo wrote:
     
    >
    >
    >It doesn't change a thing. The same messy characters are in the db. Any
    >other ideas?
    >
    >
    >
    >
    > [/ref]
    >setting
    >
    > [/ref]
    >execute
    >
    > [/ref]
    >nothing
    >
    > [/ref]
    >the
    >
    > [/ref]
    >
    >
    >
    >[/ref]
    Steve Guest

  5. #5

    Default Re: Code Page

    Steve Kass wrote: 

    Good thought, but vbscript is unicode by default.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Guest

Similar Threads

  1. Passing code/data from code-behind to ASPX page
    By A. Atienza in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: December 8th, 06:29 PM
  2. Code Behind page
    By IntraRELY in forum ASP.NET General
    Replies: 3
    Last Post: July 28th, 05:17 PM
  3. Fitting the asp code in a page inside the asp code in a template
    By rogerwithnell webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 3
    Last Post: July 17th, 11:29 AM
  4. page comes up in code
    By Mark W. Arney in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 16th, 03:23 AM
  5. Replies: 0
    Last Post: July 11th, 06:27 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139