Forums
This topic is locked
Unicode don't work with ASP upload 2.13
Posted 07 Sep 2003 21:13:37
1
has voted
07 Sep 2003 21:13:37 Remco Reitsma posted:
(*It seems that the error is comming from the UploadFormRequest function.
It doesn't handle the unicode
Function UploadFormRequest(name)
Dim keyName
keyName = LCase(name)
if IsObject(UploadRequest) then
if UploadRequest.Exists(keyName) then
if UploadRequest.Item(keyName).Exists("Value" then
UploadFormRequest = UploadRequest.Item(keyName).Item("Value"
end if
end if
end if
End Function
-- But than again. i'm just guessing. --
*)
Hello,
I made a website that can handle multiple languages. When i add a record with a file in english or dutch i have no problem.
but when i want to add a record in chinese. it doesnt work.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in string in query expression '''.
/xtranet 2.0/asp/admin/rubriek_add.asp, line 149
And when i add chinese text when the website is set to english layout it does upload but the text is scrambled.
I've set the correct unicode properties for all the pages and used the utf8 codepage.
i use an access 2002 Database and have no problem viewing chinese on the website.
I hope anyone can help me.
regards,
Dutchruler
Edited by - Dutch ruler on 08 Sep 2003 00:30:26
Replies
Replied 08 Sep 2003 14:51:14
08 Sep 2003 14:51:14 Patrick Woldberg replied:
Which version of Pure ASP Upload do you use and what is the code that is on line 149 of rubriek_add.asp?
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 08 Sep 2003 19:09:41
08 Sep 2003 19:09:41 Remco Reitsma replied:
The version of ASP upload is 2.13.
The error is being made when the script inserts a record using sql.
this is the script.
<i>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(UploadFormRequest("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
<b>MM_editCmd.Execute</b>
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
</i>
line 149 is the MM_editCmd.Execute command.
This problem happends because in the previous script when the variables are dimmed and filled the function Uploadformrequest is being used. Instead of the request.form.
This is that script.
<i>
<%
' *** Insert Record: (Modified for File Upload) set variables
If (CStr(UploadFormRequest("MM_insert") = "fmupload" Then
MM_editConnection = MM_XtraNet2_STRING
MM_editTable = "Rubrieken"
MM_editRedirectUrl = "rubriekbeheer.asp"
MM_fieldsStr = "WebSiteNaam|value|titel|value|beknopt|value|textarea|value|Plaatje|value"
MM_columnsStr = "WebsiteNaam|',none,''|RubriekNaam|',none,''|Beknopt|',none,''|Tekst|',none,''|Plaatje|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(<b>UploadFormRequest(MM_fields(MM_i))</b>
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If
End If
%>
</i>
I know that this solution has to be used because you couldnt combine the binairywrite and form.request. but the Uploadformrequest doesnt support Unicode. So the values that return from that function will be junk.
Is it possible to make the uploadformrequest function compatible with Unicode (UTF-8) ?
Anyway thanks for all the help you can give me.
Regards,
Remco
Edited by - Dutch ruler on 08 Sep 2003 19:11:33
The error is being made when the script inserts a record using sql.
this is the script.
<i>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it
Dim MM_tableValues
Dim MM_dbValues
If (CStr(UploadFormRequest("MM_insert") <> "" Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
<b>MM_editCmd.Execute</b>
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
</i>
line 149 is the MM_editCmd.Execute command.
This problem happends because in the previous script when the variables are dimmed and filled the function Uploadformrequest is being used. Instead of the request.form.
This is that script.
<i>
<%
' *** Insert Record: (Modified for File Upload) set variables
If (CStr(UploadFormRequest("MM_insert") = "fmupload" Then
MM_editConnection = MM_XtraNet2_STRING
MM_editTable = "Rubrieken"
MM_editRedirectUrl = "rubriekbeheer.asp"
MM_fieldsStr = "WebSiteNaam|value|titel|value|beknopt|value|textarea|value|Plaatje|value"
MM_columnsStr = "WebsiteNaam|',none,''|RubriekNaam|',none,''|Beknopt|',none,''|Tekst|',none,''|Plaatje|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(<b>UploadFormRequest(MM_fields(MM_i))</b>
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If
End If
%>
</i>
I know that this solution has to be used because you couldnt combine the binairywrite and form.request. but the Uploadformrequest doesnt support Unicode. So the values that return from that function will be junk.
Is it possible to make the uploadformrequest function compatible with Unicode (UTF-8) ?
Anyway thanks for all the help you can give me.
Regards,
Remco
Edited by - Dutch ruler on 08 Sep 2003 19:11:33
Replied 10 Sep 2003 08:27:50
10 Sep 2003 08:27:50 Patrick Woldberg replied:
I will try to get this fixed.
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 14 Apr 2006 17:45:21
14 Apr 2006 17:45:21 Wu chan15 replied:
I got the same problem
my version is 2.2.1, my username is chan15
I think it's not support double byte word
do you have solution now?
it's not an inexpensive extension~ <img src=../images/cfzone/forum/icon_smile_sad.gif border=0 align=middle>
my version is 2.2.1, my username is chan15
I think it's not support double byte word
do you have solution now?
it's not an inexpensive extension~ <img src=../images/cfzone/forum/icon_smile_sad.gif border=0 align=middle>