Solved

Need to save UniCode characters to SQLdb- How is this done?

Posted on 2001-06-28
8
232 Views
Last Modified: 2006-11-17
I have a password field that gets encrypted characters. In SQL server the field is an nvarchar an it should accept any character, however it does not. Speaking with Nigel in the SQL expert area he has stated;

"What is the field supposed to hold - you only need ntext if the field needs to be more than 4000 chars.
text fields are a lot more difficult to manipulate than chars so should only be used if necessary.The nvarchar field will accept any unicode character - if it is not then there is probably a problem with your interface. The field needs to be handled as unicode everywhere."

I believe he is on to the answer, but i'm not sure I'm sending unicode to the db or more likely the case I'm not accepting them back. How do I save and retrieve Unicode characters (strings) and why is this a problem?

0
Comment
Question by:rblackwell
[X]
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
8 Comments
 
LVL 5

Expert Comment

by:raizon
ID: 6235383
I'm not sure if this will work but you can try setting the enctype in the form element (enctype="multipart/form-data").  That is what is required to send non-ascii data via a form.

HTH

Raizon
0
 
LVL 15

Accepted Solution

by:
robbert earned 150 total points
ID: 6235541
This works:

INSERT INTO table (nvarchar-field)
VALUES (N'unicode-string')

However, I didn't find a way to make:

objRst.AddNew
objRst("nvarchar-field") = "unicode-string"
objRst.Update

to work, trying variations.

HTH
0
 

Expert Comment

by:globarena
ID: 6237348
hi rblackwell,

Try with  this:


<META http-equiv=Content-Type content="text/html; charset=unicode">

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Expert Comment

by:Silvers5
ID: 6237471
the form should be unicode and the script code page should be set to your character set:

ussian code page:

<%@ Language=VBScript Codepage=1251%>

or

Session.CodePage=1251

(Session.LCID = 1251  'location identifier, used for currency,date etc formats)


these code page links might help:

http://www.microsoft.com/globaldev/reference/WinCP.asp
http://www.microsoft.com/globaldev/win2k/setup/localsupport.asp
http://www.microsoft.com/globaldev/FAQs/Locales.asp
0
 

Author Comment

by:rblackwell
ID: 6239477
Roberts idea to use "INSERT INTO table (nvarchar-field)
VALUES (N'unicode-string')" seems to be in line with our coding requirments.
The result however is this ->
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'wyi'.
My SQL statement passed to ADO is this ->
SQL=UPDATE Customers SET PassWord = N 'wyi' WHERE Username = 'rblackwell'

The part 'wyi' is the encoded password with non-ascii chars. Why does it not like the SQL statment???
0
 
LVL 15

Expert Comment

by:robbert
ID: 6239508
I must admit that the N' (and the codepage) thing is all I know. Also, I grabbed my suggestion from somewhere, and it just worked with ASCII characters, and nXX fields in SQL Server (that's a first achievement as nXX fields can't be addressed, otherwise).
Sorry.
0
 

Author Comment

by:rblackwell
ID: 6239520
There was an extra space after the N - now it works.
Thanks Once Again to my man Robert!
0
 
LVL 15

Expert Comment

by:robbert
ID: 6239648
At least, it works somehow :-)
And thanks, I just posted because you're such a "good" questioner.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery Check against database on select from auto fill not working in all browsers 5 56
ASP AND XML 3 41
Sending ASP to server side 8 43
Passing ASP variables in JQuery 4 52
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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