Showing posts with label ntext. Show all posts
Showing posts with label ntext. Show all posts

Tuesday, March 20, 2012

Check for unicode within an ntext

Hey all,
I've got to check an ntext column if it actually does contain unicode characters or not. I would prefer to not have to iterate through every character in each column, is there a simple way to do this in sql server 2000?
Cheers,
-KilkaCAST or CONVERT it to text, and monitor for errors.|||That's a great idea, thanks Blindman.

Cheers,
-Kilka

Tuesday, February 14, 2012

character encoding problem

I'm storing data in SQL Server 2005 Express ntext fields. I've added <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> to the Master Page, but apostrophes and other characters are appearing incorrectly in the browser. For example, apostrophes are appearing as?. They seem to have changed to this when I upsized from Access to SQL Server (so I have? in the db field).

The back-end of the site is still in classic asp, where I can set the CodePage to 65001 and the CharSet to utf-8, and everything appears fine there. What can I change in the ASPX to get characters to display correctly?

Apostrophes in SQL Server falls under ANSI SQL 92 delimiters you have to take care of that in SQL Server and other characters fall under collation so it will help if you check both to see where the problem is coming from. The aspx pages falls under encoding in VS2005 you can use the advanced option to choose the editor to use to save your code that includes the code page and encoding. The links below will help you with delimiter and page level encoding in .NET. Hope this helps.

http://msdn2.microsoft.com/en-us/library/ms176027.aspx
http://www.yoda.arachsys.com/csharp/strings.html


|||

This conversion of apostrophes and other characters such as dashes took place when I used the upsizing wizard in Access. I thought the classic asp pages were somehow converting them and displaying them correctly. I was wrong - I had forgotten to change the connection string, so they were still connecting to the old Access dbEmbarrassed

For the sake of speed, I cobbled together a little VBScript and ran it against the SQL Server db to perform a quick find and replace.

|||So you have fixed the problem? if not let me know so we can find what needs to be fixed.