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,
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:
>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?
>
>|||"Steve Kass" <skass@.drew.edu> wrote in message
news:%23xM75ETpEHA.1712@.tk2msftngp13.phx.gbl...
> 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.
It doesn't change a thing. The same messy characters are in the db. Any
other ideas?
> Steve Kass
> Drew University
> Agoston Bejo wrote:
> >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?
> >
> >
> >
> >|||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:
>"Steve Kass" <skass@.drew.edu> wrote in message
>news:%23xM75ETpEHA.1712@.tk2msftngp13.phx.gbl...
>
>>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.
>>
>
>It doesn't change a thing. The same messy characters are in the db. Any
>other ideas?
>
>
>>Steve Kass
>>Drew University
>>Agoston Bejo wrote:
>>
>>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?
>>
>>
>>
>
>|||Steve Kass wrote:
> 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.
>
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"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment