Oct 24, 2006

Uncide code in ASP & MSSQL

ref: http://support.jodohost.com/showthread.php?t=2356

Unicode has two encoding formats: UTF-8 and UCS-2. Web browsers speak UTF-8. On the other hand, most DBMSes speak UCS-2. In MS SQL 2000 Server, searching and string comparison work robustly if Unicode data were stored only in UCS-8 format. However, Internet Explorer can display Unicode data only in UTF-8.

Thus, the requirement is to convert between UTF-8 and UCS-2. Fortunately, in Microsoft-based web application, IIS can take responsibility of Unicode format conversion by adding "<% Session.Codepage=65001 %>" or "<%@ CodePage=65001 %>" to the server-side ASP script responsible for database manipulation.

eg.
<%@ Language=VBScript CODEPAGE=65001 %>
<%Session.Codepage=65001 %>

For more details, please visit
INF: Storing UTF-8 Data in SQL Server
http://support.microsoft.com/default...&Product=sql2k


If your application uses Active Server Pages (ASP) and you are using Internet Information Server (IIS) 5.0 and Microsoft Windows 2000, you can add "<% Session.Codepage=65001 %>" to your server-side ASP script. This instructs IIS to convert all dynamically generated strings (example: Response.Write) from UCS-2 to UTF-8 automatically before sending them to the client.

If you do not want to enable sessions, you can alternatively use the server-side directive "<%@ CodePage=65001 %>".

Any UTF-8 data sent from the client to the server via GET or POST is also converted to UCS-2 automatically. The Session.Codepage property is the recommended method to handle UTF-8 data within a web application. This Codepage setting is not available on IIS 4.0 and Windows NT 4.0. For additional information, see the following article in the Microsoft Knowledge Base:



In query statement, should use
select * from [TABLE] where [FIELDS] = N'[SEARCH_TEXT]'


Stored Procedures should be use adVarWChar instead of adVarChar

附:
'---- DataTypeEnum Values ----
Const adEmpty = 0
Const adTinyInt = 16
Const adSmallInt = 2
Const adInteger = 3
Const adBigInt = 20
Const adUnsignedTinyInt = 17
Const adUnsignedSmallInt = 18
Const adUnsignedInt = 19
Const adUnsignedBigInt = 21
Const adSingle = 4
Const adDouble = 5
Const adCurrency = 6
Const adDecimal = 14
Const adNumeric = 131
Const adBoolean = 11
Const adError = 10
Const adUserDefined = 132
Const adVariant = 12
Const adIDispatch = 9
Const adIUnknown = 13
Const adGUID = 72
Const adDate = 7
Const adDBDate = 133
Const adDBTime = 134
Const adDBTimeStamp = 135
Const adBSTR = 8
Const adChar = 129
Const adVarChar = 200
Const adLongVarChar = 201
Const adWChar = 130
Const adVarWChar = 202
Const adLongVarWChar = 203
Const adBinary = 128
Const adVarBinary = 204
Const adLongVarBinary = 205
Const adChapter = 136
Const adFileTime = 64
Const adDBFileTime = 137
Const adPropVariant = 138
Const adVarNumeric = 139


===========================================
After import data from Text file to database, NText is used
using
cast([FIELD_NAME] as nvarchar(%SIZE%))
to convert the fileds into nvarchar

Sep 26, 2006

after installed IBM RAD 6, WAS 6 failed to install

Reference: http://www.marksu.idv.tw/categories/ibm/rational/

又學了一招
Posted in IBM, Rational, Rational Software Architect by 馬克ㄙㄨ on the January 9th, 2006

由於上個週末將電腦重灌的關係
所以陸陸續續也要把相關的軟體灌好

不幸的是
在我重新安裝 RSA 的時候,就那麼剛好給我當機
結果在重新開機之後
雖然 RSA 可以順利的安裝好,但是 RSA 內附的 WAS6 測試環境就是怎麼樣也裝不起來
查看了一下 log
log 裡面說
“請指定另一個目錄或執行手動解除安裝來移除所有套件,之後,再重新安裝到相同目錄。”
找遍了 Windows 上面的 registry 和 temp 檔,就是找不到 WAS6 安裝過的蹤跡。
這個時候只好來找找 IBM WAS6 的 infocenter 了….雖然不是抱著很高的期望….
結果在 infocenter 的搜尋功能上面輸入了 “ISMPWarningDialogAction, wrn”
居然跳出了下面這個頁面
在安裝和建立設定檔時所發出的訊息
接著找到
指定另一個目錄或者以手動方式解除安裝
想不到,居然會有底下這個….

# 編輯 vpd.properties 檔。
這個檔案是位於作業系統的安裝目錄內,例如 C:\WINNT 目錄或 C:\windows 目錄。
請勿刪除 vpd.properties 檔案或將其更名,因為 InstallShield for MultiPlatforms (ISMP) 程式會在它安裝的其他產品使用這個檔案。
如果您要解除安裝的 WebSphere Application Server 產品,是在 vpd.properties 檔中有項目存在的唯一產品,您就可以刪除這個檔案。

看到這個內容
我小心翼翼的將 vpd.properties 裡面,有 base_v6 字樣的那幾行都給移除掉
最後再到 RSA 安裝光碟的第四片底下
在 \external\was6 這個路徑下執行

“f:\rsa6\install\disk4\external\was6\rat_wasinstall.exe”
-silent -options “f:\rsa6\install\disk4\external\was6\rat_responsefile.txt”
-P wasProductBean.installLocation=”D:\IBM\Rational\SDP\6.0\runtimes\base_v6″

這段字串,大家可以在 RSA 的安裝路徑下,找到 log 這個資料夾
應該會看到有一個 was_v6_out.log
打開之後應該可以找的到長的差不多的一串文字
然後在 DOS 下執行就成了