Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 character encoding

Author  Topic 

obscuregirl
Starting Member

41 Posts

Posted - 2007-03-23 : 10:45:48
Hi

I have a user who is using data from my database for a webportal. One of my tables had a field that was type NText. The technology he is using couldn't cope with NText so i changed the data type to nvarchar instead. The user is now getting some superfluous characters coming back as part of the data in the field e.g. '12\r\n' where a space appears if looking at the data through something like Query Analyser. He was asking if I could change the character encoding to Unicode.

I thought that datatypes like Nvarchar were unicode anyway but I guess the fact that I changed the type might mean that I need to explicitly declare it as unicode. Does anyone know if this is the case?

thanks.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-03-23 : 11:06:02
i don't think this has anything to do with encoding.
if you select data in query analyzer in grid mode then it will show all char like '\r' or '\n'
because it can't put the data into 2 rows.
tell him to view data in text mode instead.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2007-03-23 : 11:12:57
Have a look at the data in your column. If it is \r\n then it is a data proble. If it's x00130010 then it's a display problem.
I suspect the client isn't interpreting crlf's properly. Try it as varchar rather than nvarchar.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

obscuregirl
Starting Member

41 Posts

Posted - 2007-03-23 : 11:18:03
quote:
Originally posted by spirit1

i don't think this has anything to do with encoding.
if you select data in query analyzer in grid mode then it will show all char like '\r' or '\n'
because it can't put the data into 2 rows.
tell him to view data in text mode instead.



I don't see those characters in Query Analyser. My user sees them when he extracts the data. I don't know exactly what technology he's using though, it's web-based.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-03-23 : 11:32:44
Well what's the query?

And why are you using unicode?

bcp the data out to a file and look at it there

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

obscuregirl
Starting Member

41 Posts

Posted - 2007-03-23 : 11:47:29
quote:
Originally posted by X002548

Well what's the query?

And why are you using unicode?

bcp the data out to a file and look at it there

Brett

8-)



I don't think I am using unicode explicitly. I thought nvarchars were unicode compatible fields from what I've read. I'm afraid this is all very new to me so I don't really understand it. My user is asking me to change the field encoding to unicode because he is getting strange characters when he extracts data using the technology he's using (I think it's called Python). Until he asked this, I didn't even know that I could change the character encoding, so hence the question - can I do it and if so, how?!
Go to Top of Page
   

- Advertisement -