-
Unicode & Database
Hi guys
I was working on Unicode for a while and finally I learned how to use it in order to show Chinese, Arabic, and Indian etc. I show them on “MS forms 2.00” which is consisted of controls that support Unicode. Now I can display and type any language in them. BUT a few problems:
1.How can I store a Unicode string in to a database (a mdb for example)?
2. how can I restore Unicode strings form a db?
As an Unicode character is a 2 byte one and a simple ASCII char is 1 byte. a database string field refuses to accept my Unicode string.
Any suggestions? I’m thinking of using the binary field type but it is limited and also I think it will work very slowly besides I’ll have to say goodbye to SQL queries.
-
Re: Unicode & Database
-
1 Attachment(s)
Re: Unicode & Database
it only matter with following two lines:
<% @ codepage=65001 %>
and
OpenSchema
This is ASP vbscript
Here is the Code:
Code:
<% @ codepage=65001 %>
<%
Dim f
Response.CharSet = "utf-8"
Set cnnDB = CreateObject("ADODB.Connection")
strDBPath=server.MapPath ("TntjKuwait.mdb")
With cnnDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open strDBPath
End With
Set rstList = cnnDB.OpenSchema(4)
Set rstList = cnnDB.Execute("SELECT * FROM tblfirst")
Set f = rstList(1)
Do Until rstList.EOF
Response.Write f
Response.Write "<BR>"
rstList.MoveNext
Loop
rstList.Close
cnnDB.Close
%>
I included 4 different language (Arabic, Persian,Urdu & tamil )strings in Database field to check Unicode functionality.
Al-Qaim:check:
http://www.vbforums.com/images/ieimages/2011/01/1.jpg
-
Re: Unicode & Database
Jet 4.0 databases handle Text and Memo fields as Unicode naturally. Only ancient Jet 3.5 ("Access 97") and earlier uses ANSI.
The Forms 2.0 library has numerous restrictions on its use is was never approved for use in VB6 programs.
I have no idea how an ASP example has anything to do with this subject at hand.