Link to home
Start Free TrialLog in
Avatar of tn_bobbie
tn_bobbie

asked on

CLassic ASP & international chars

HI ALl,

I have an ASP page (page1.asp)  with a text box & the user is putting ¼ in the text box. I've set charset of this page to utf-8. IN the second page (page2.asp), I'm trying to insert into an Oracle table with a simple insert statement. But it turns garbled in the DB. The code is attached.

These r the datatypes I tried

COL_V_CHAR (used in code) - VARCHAR2(100 CHAR)
COL_V_BYTE (used in code) - VARCHAR2(100 CHAR)
COL_N_CHAR (used in code) - NVARCHAR2
COL_CLOB (used in code) - CLOB
COL_NCLOB (used in code) - NCLOB

Nothing worked, its all junk in all the columns.

I'm not suspecting Oracle because, when I use a plain insert statement like

INSERT INTO TABLE(COL) VALUES('¼'). It is saved good in DB & I can see that as is..

SO the IIS (IIS6 in this case) is doing something.

An ideas??

Thanks
Bobbie
Page1.asp
<%@ Language=VBScript%>
<%Session.Codepage=65001%>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<form name="frm" action="test2.asp" method="POST">
	<input type="text" name="txt1">
	<input type="submit" value="submit">
</form>
--------------------------------------------------------------
Page2.asp
<%
Session.Codepage=65001
dim strTestSQL, strJustification
 
strJustification = "µ"
 
strJustification = Request.Form("txt1")
 
Response.Write(strJustification & "---strJustification<br />")
 
Response.Write(Request.Form("txt1") & "---Request.Form)<br />")
			
'strTestSQL = "UPDATE OUTLIER_HISTORY SET RESUB_JUSTIFICATION = ' µ  -- Inserting with SQL INSERT stat' WHERE OUTLIER_HISTORY_ID = 89188"
'strTestSQL = "UPDATE OUTLIER_HISTORY SET RESUB_JUSTIFICATION = '" & strJustification & "' WHERE OUTLIER_HISTORY_ID = 89188"
 
strTestSQL = "INSERT INTO NAGENDRATEST(COL_V_CHAR, COL_V_BYTE, COL_N_CHAR, COL_CLOB, COL_NCLOB) VALUES ('" & Request.Form("txt1") & "','" & strJustification & "','" & Request.Form("txt1") & "','" & Request.Form("txt1") & "','" & Request.Form("txt1") & "'  )"
 
Response.Write(strTestSQL & "--strTestSQL<BR />")
				
cnConnect.Execute(strTestSQL)
				
Response.Write("--Done<BR />")
%>

Open in new window

Avatar of brad2575
brad2575
Flag of United States of America image

If you do a responce.write and/or debug, what is the value of the field with the 1/4 in it what does the value look like?

the browser/server may be converting the 1/4 to a HTML code value for that and this value may have special characters in it and SQL/Oracle may not like the special characters.

I would say try to debug and see what the value of the field is just before inserting it (if you could get the SQL query from debugging and post here that would be helpful)
Avatar of tn_bobbie
tn_bobbie

ASKER

HI Brad,

WHen I do a response.write This is what I see

¼ testing---Request.FormVal

INSERT INTO NAGENDRATEST(COL_V_CHAR, COL_V_BYTE, COL_N_CHAR, COL_CLOB, COL_NCLOB) VALUES ('¼ testing','¼ testing','¼ testing','¼ testing','¼ testing' )--strTestSQL

Thanks
B

Actually, the browser display the char correctly in my case.

BUt when I copy paste it here, its lost.

Thats the MU  - microgram char.
ASKER CERTIFIED SOLUTION
Avatar of tn_bobbie
tn_bobbie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial