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

ASPMicrosoft IIS Web Server

Avatar of undefined
Last Comment
tn_bobbie

8/22/2022 - Mon
brad2575

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)
ASKER
tn_bobbie

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

ASKER
tn_bobbie

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

BUt when I copy paste it here, its lost.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
tn_bobbie

Thats the MU  - microgram char.
ASKER CERTIFIED SOLUTION
tn_bobbie

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question