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
Solved

Codepage problem in asp pages, mssql database

Posted on 2008-10-09
8
467 Views
Last Modified: 2009-07-29
can't seem to get diacritics when pulling out data from sql database

conn string is:
i_dbConnection = "Driver={SQL Native Client}; Server=xxx.xxx.xxx.xxx\SQLEXPRESS,xxxx; Database=db; UID=; Pwd="

asp page:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1250" LCID="1050" %>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">

when i query database from sql management studio everything shows up fine.
0
Comment
Question by:fokuszg
  • 5
  • 3
8 Comments
 
LVL 4

Expert Comment

by:rhodesb
ID: 22682254
What diacritics specifically?  ASP script (VBScript) will have trouble with quotes and apostrophes because they are used by the script itself.
What I usually do is make sure that the escape character is stored in the database as well.  For example, in VBScript to escape, you use the same character twice so if you used the name O'Hanlan, make sure it is stored in the database as O''Hanlan using vbscript string 'replace()' function.  Or you could replace the character with something that doesn't cause a problem (like a pipe | ) when storing the data and replace it back to what it is supposed to be when you pull the data back out of the database.  Or you can use replace to store the ASCII value of the character [tempString = replace(tempString,"'", chr(39))].  The script won't see this as an apostrophe but when it is displayed in HTML, the browser will see it as an apostrophe.
0
 
LVL 2

Author Comment

by:fokuszg
ID: 22682305
croatian diacritic characters, not special characters.
0
 
LVL 4

Assisted Solution

by:rhodesb
rhodesb earned 100 total points
ID: 22682380
Sorry, I don't have any real experience dealing with non-English or non-standard characters.  I would try putting one of the characters into a static string to see if asp will deal with it.  Try to narrow down whether your problem is the asp script itself, your recordset object or the database (it sounds like the database is not the problem because your queries work from the management studio).  If it is a problem with a limitation in the asp script, then I'm not sure what the solution would be but if it is a problem with the recordset object, then my solution of using substitute characters and then changing them back should work.  Sorry I couldn't be of more help.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 2

Author Comment

by:fokuszg
ID: 22682465
its neither
i have a different website on my own server and it works perfectly with the same asp code
only difference is this is a hosted server and i donno what they could have done differently when setting up mssql
0
 
LVL 4

Expert Comment

by:rhodesb
ID: 22682520
Ok.  I'm not sure what they would have set up differently either.  Perhaps a language pack that is installed on your server but not the hosted one?  Sorry I couldn't be of more help.
0
 
LVL 2

Author Comment

by:fokuszg
ID: 22682535
Thx for trying anyway
0
 
LVL 2

Author Comment

by:fokuszg
ID: 22682789
i identified the source of the problem.
the table i created manually on sqlsrver works fine, but the tables that are transfered via webservice do not display characters correctly. i do not understand why, since they both look just fine when paging records for management studio
0
 
LVL 2

Accepted Solution

by:
fokuszg earned 0 total points
ID: 22686722
or not
problem was... i was using stored proc to pull the data out, in a mannor that they fill the temp table and when creating temp table data type was varchar. i just used nvarchar and everything worked out fine.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

856 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