|
- Menu -
|
|
This page will teach you;
How to integrate Japanese with English Microsoft Access Database and English SQL Server Database How to send Japanese auto-Email from English server How to add, edit or save Japanese text file in English server How to save or retrieve Japanese Cookies in English server How to change Japanese version of MS Access Database into English version
1. Japanese Code setting
In order to prevent getting scramble words while saving or retrieving words from database, it is required to set the same language code for all pages. In case of requiring mailing in Japanese
<% @CodePage=932 %> <-- Place this code on the top <meta http-equiv="content-type" content="text/html;charset=shift_jis"> <-- Place this code between <head> and </head> tags.
In case of requiring mailing in English or another European languages
<% @CodePage=65001 %> <-- Place this code on the top <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <-- Place this code between <head> and </head> tags.
2. Japanese Email
In case of mailing in Japanese or European language using ASPMail
In order to prevent getting scramble words, specify a charset in Email scripts. ASPMail does not require to specify code setting of <% @CodePage=932 %>. But <meta http-equiv="content-type" content="text/html;charset=shift_jis(or charset=_autodetect)"> need to be placed between <head> and </head> tags. For full ASPMail documentation and more examples, please visit ServerObjects.com.
<% Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.ContentType = "text/plain" Mailer.CustomCharSet = "shift-jis" 'Japanese=shift-jis(or iso-2022-jp), Europe=iso-8859-1 Mailer.RemoteHost = smptServer 'smpt Server address provided by ISP Mailer.FromName = Mailer.EncodeHeader(clientname) Mailer.FromAddress= clientemail Mailer.AddRecipient Mailer.EncodeHeader(clientname2), clientemail2 'This will add more recipient Mailer.AddBCC Mailer.EncodeHeader(adminname), adminmailaddress 'This will add more BCC Mailer.ReplyTo adminmailaddress 'This will add reply email address Mailer.Subject = Mailer.EncodeHeader("Email Subject") Mailer.BodyText = body if Mailer.SendMail then Response.Write "Mail has been sent!" else Response.Write "Error was: " & Mailer.Response end if %>
In case of mailing in English using ASPMail
No charset setting is required in Email scripts. For full ASPMail documentation and more examples, please visit ServerObjects.com.
<% Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.ContentType = "text/plain" Mailer.RemoteHost = smptServer 'smpt Server address provided by ISP Mailer.FromName = clientname Mailer.FromAddress= clientemail Mailer.AddRecipient clientname2, clientemail2 'This will add more recipient Mailer.AddBCC adminname, adminmailaddress 'This will add more BCC Mailer.ReplyTo adminmailaddress 'This will add reply email address Mailer.Subject = "Email Subject" Mailer.BodyText = body if Mailer.SendMail then Response.Write "Mail has been sent!" else Response.Write "Error was: " & Mailer.Response end if %>
In case of mailing in Japanese using CDONTS
In order to prevent getting scramble words, require to specify code setting first, then specify a charset in e-mail scripts. For a CDONTS documentation and example of how to send e-mail in Japanese, please visit support.microsoft.com.
<% Set objMail = server.CreateObject("CDONTS.Newmail") objMail.SetLocaleIDs(932) objMail.From = clientemail objMail.To = adminmailaddress objMail.Cc = clientemail2 & ";" & clientemail3 'This will add more CC objMail.Bcc = clientemail4 & ";" & clientemail5 'This will add more BCC objMail.Subject = "Email Subject" objMail.Body = body objMail.MailFormat = 0 'MIME objMail.BodyFormat = 1 '0 HTML / 1 Text '****************************************************** On Error resume next '← Omit if not getting any error message '****************************************************** objMail.Send
'****************************************************** '↓↓↓ Omit scripts if not getting any error message ↓↓↓ If err.number <> 0 Then Response.Write "Error encountered: " & Err.Description else ' Response.Write "Mail has been sent!" End If '↑↑↑ Omit scripts if not getting any error message ↑↑↑ '****************************************************** Set objMail = Nothing
'************* Comments ****************************** 'Unfortunately in CDONTS, an error message won't come out like other components 'when E-mail didn't go through. Please test if you will get any error message for not sending. 'If you do not getting any error message then you do not need to include the scripts which 'I showed above. '****************************************************** %>
In case of mailing in Japanese using BASP21 component
In order to prevent getting scramble words, require to specify code setting first, then specify a charset in Email scripts.
BASP21 DLL (You may heard about it) is very well known among Japanese ASP users. Ask your ISP to install BASP21 DLL into your English server before using it.
The detail description will find at: http://www.hi-ho.ne.jp/babaq/eng/basp21.html
It is free ware. In this description does not mention about supporting window2000, but I already know that some other people are already using it.
If you like, there is also a commercial version, Basp 21 Pro. You can find the detail info. at; http://www.terra-intl.com/basp21/index.html
<% Set bobj = Server.CreateObject("basp21") bobj.CodePage = 932 svname = smptServer 'smpt Server address provided by ISP mailto = clientname & "<" & clientemail & ">" & vbTab & "bcc" & vbTab & adminname & "<" & adminmailaddress & ">" mailfrom = clientname & "<" & clientemail & ">" subj = "Email Subject" body = "Hello!" rc = bobj.SendMail(svname,mailto,mailfrom, subj,body,"") If rc="" then Response.Write "Mail has been sent!" else Response.Write "Error was: " & rc end if %>
3. Japanese text file
In order to prevent getting scramble words, require to specify English code <% Session.CodePage=1252 %> right before start Server.CreateObject scripts. Add <% Session.CodePage=932 %> right before wherever wanted to show Japanese words.
In case of reading in Japanese text file using Server.CreateObject
<% @CodePage=932 %> <% Response.Write "日本語" %> <% Session.CodePage=1252 %> <% Set fso = Server.CreateObject("Scripting.FileSystemObject") Set tso = fso.OpenTextFile(Server.MapPath("./test.txt")) Response.Write tso.ReadAll tso.Close Set tso= nothing Set fso = nothing %> <% Session.CodePage = 932 %> <% Response.Write "日本語" %>
In case of creating in Japanese text file using Server.CreateObject
<% @CodePage=932 %> <% Response.Write "日本語" %> <% Session.CodePage=1252 %> <% Set fso = Server.CreateObject("Scripting.FileSystemObject") Set tso = fso.CreateTextFile(Server.MapPath("./test.txt")) textFile.WriteLine("日本語") tso.Close Set tso= nothing Set fso = nothing %> <% Session.CodePage = 932 %> <% Response.Write "日本語" %>
4. Japanese Cookies
In order to prevent getting scramble words, require to specify code setting first, then specify a Base64 setting with BASP21 component.
BASP21 DLL (You may heard about it) is very well known among Japanese ASP users. Ask your ISP to install BASP21 DLL into your English server before using it.
The detail description will find at: http://www.hi-ho.ne.jp/babaq/eng/basp21.html
It is free ware. In this description does not mention about supporting window2000, but I already know that some other people are already using it.
If you like, there is also a commercial version, Basp 21 Pro. You can find the detail info. at; http://www.terra-intl.com/basp21/index.html
In case of creating Japanese Cookies using BASP21 component
<% SUB addCookie( theName, theValue )
Set bobj = Server.CreateObject("basp21") bobj.CodePage = 932 Response.Cookies( theName ) =bobj.Base64(theValue,0)
' Response.Cookies( theName ).Expires = "July 31, 2002" 'In case specifying date
Response.Cookies( theName ).Expires = Date + 365 Response.Cookies( theName ).Path = "/" Response.Cookies( theName ).Secure = FALSE set bobj = nothing
END SUB %>
In case of retrieving Japanese Cookies using BASP21 component
<% FUNCTION requestCookie( theString )
Set bobj = Server.CreateObject("basp21") bobj.CodePage = 932 requestCookie = bobj.Base64(request.cookies(theString),1) set bobj = nothing
END FUNCTION %>
5. Japanese SQL Server scripts tips
In case of writting or retrieving Japanese words from SQL Server
Put N infront of not numeric, not date, and not currency numbers.
<%
sqlString = "SELECT * FROM table " &_ "WHERE table_username= N'" & username & "' " &_ "AND table_password= N'" & password & "' "
%>
In case of searching Japanese words from SQL Server using date script (if date is not date format)
<%
sqlString = "SELECT *" &_ "FROM table" &_ "WHERE (order_entrydate < CONVERT(DATETIME, N'1/1/2004'))"
%>
6. MS Access Database - change Japanese version into English version
Even if your MS access database was meant to be English charactors only, if your working station has a Japanese local setting, it seems MS access database adapts the local language setting and becomes Japanese version of MS access database automatically. And that is creating an error message of;
[Microsoft][ODBC Microsoft Access Driver] Selected collating sequence not supported by the operating system.
when you are accessing MS access database through ODBC connection from ASP page at English system server.
You can check if this case is applying to you by testing the both following SQL scripts;
<%
sqlString = "SELECT * FROM table_name "
%>
<%
sqlString = "SELECT * FROM table_name " &_ "ORDER BY field_name "
%>
If you getting the same error message above at only at the second SQL script then your case is most likely applying to this case.
There are two ways to solve this problem.
One way is to ask your ISP support to enable additional languages, Japanese in your English system server. This is necessary if you need to use Japanese charactors at your MS access database. This is the URL of how to enable additional language in English system server; http://support.microsoft.com/kb/177561/EN-US/
Another way is to change Japanese version of MS access database into English version. If your database is meant to be used only English charactors this way works.
This is how: (Before making any changes, always keep a back up.)
Open MS access database. Tools --> Options --> General tab --> Check General (or English) at "Newdata sort order:" section. --> Click "Apply" button.
However, this new data setting only apply to a new data. To change the setting of old database to the new setting, user needs to do either way of "Compacting" old database, or copy and paste old table to anew table with the same structure and data option.
To compacting old database, open MS access database. Tools --> Database Utilities --> Compact and Repair Database
To copy and paste to a new table, select each table --> Ctrl + C (Copy) then Ctrl + V (Paste) --> Set the different table name and check "structure and data" at Paste Options --> Repeat for all the tables --> Delete all the old table and rename all new tables back to the originaltable names
These methods should change MS Access Database from Japanese version into English version.
|
|
|
|
|