Good day all,
I encountered were strange problem during my work.
When I call stored procedure from JScript (Jscript code is compiled by 3rd party desktop application that uses windows script 5.6) and give it data through parameters it ends up that data stored in database are different based on which localization of microsoft windows i use(eq. czech and fench).
We are using SQL server 2008 R2 express as database.
Here is Jscript code:
function file_addBinaryData(ProductionProfileID, RowData, create, DB) {
var connectionstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ABN_EXTENSIONS;Data Source=" + DB + ";";
var sp_file_row = new ActiveXObject("ADODB.Command");
var ret;
var conn = new ActiveXObject("ADODB.connection");
conn.ConnectionString = connectionstring;
conn.Open();
sp_file_row.ActiveConnection = conn;
sp_file_row.CommandText = "sp_addData_DPP";
sp_file_row.CommandType = adCmdStoredProc;
sp_file_row.Parameters.Append(sp_file_row.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue));
sp_file_row.Parameters.Append(sp_file_row.CreateParameter("@ProductionProfileID", adInteger, adParamInput, adDefaultSize, ProductionProfileID));
sp_file_row.Parameters.Append(sp_file_row.CreateParameter("@Type", adInteger, adParamInput, adDefaultSize, 1250));
sp_file_row.Parameters.Append(sp_file_row.CreateParameter("@data", adBinary, adParamInput, adMaximumSize, RowData));
sp_file_row.Parameters.Append(sp_file_row.CreateParameter("@Create", adBoolean, adParamInput, adDefaultSize, create));
sp_file_row.Execute();
ret = sp_file_row.Parameters("RETURN_VALUE");
sp_file_row.ActiveConnection.Close();
return ret;
}
Stored procedure itself is doing just insert into table.
Data are binary and are given to function by 3rd party software which stores them as varbinary and when It gives them to Jscript variable it's handled as a String and every byte of binary data is converted into unicode. Then when I'm storing it into Database it's stored into varbinary column as a unicode represtentation of original bytes from binary data.
But when I run this function on czech and french system there is difference in binary data stored in my database which seems strange as unicode shoudl be same on all systems.
Did anyone ever encountered such a problem with encoding on different language systems and solved it?
Thank you Michal