2009年7月14日 星期二

Unicode Guide in PHP and MFC

Unicode in Wikipedia (English version):
1. Unicode: http://en.wikipedia.org/wiki/Unicode

Unicode in Wikipedia (繁中版):

大部分的 Text Edit 都可以提供存成不同的 unicode 格式,如 RJ TextEd 可以提供如下面幾種 unicode 格式。


以下列出 RJ TextEd 的這幾種資料內容:

原始資料: "中文ABCDE".
1. 存成Big5時,內容為
a4 a4 a4 e5 41 42 43 44 45
2. 存成Unicode(UTF-8)時,內容為
ef bb bf e4 b8 ad e6 96 87 41 42 43 44 45 0d 0a
3. 存成Unicode(UTF-8 w/oBOM)時,內容為
e4 b8 ad e6 96 87 41 42 43 44 45 0d 0a
4. 存成Unicode時,內容為
ff fe 2d 4e 87 65 41 00 42 00 43 00 44 00 45 00 0d 00 0a 00 00 00
5. 存成Unicode(w/oBOM)時,內容為
2d 4e 87 65 41 00 42 00 43 00 44 00 45 00 0d 00 0a 00 00
6. 存成Unicode(Big-Endian)時,內容為
fe ff 4e 2d 65 87 00 41 00 42 00 43 00 44 00 45 00 0d 00 0a 00
7. 存成Unicode(Big-Endian w/oBOM)時,內容為
4e 2d 65 87 00 41 00 42 00 43 00 44 00 45 00 0d 00 0a 00

==========================================================
當 VC 有 #define _UNICODE 時,產生的檔案就是跟 #5 的檔案一樣。所以 VC 是使用 UTF-16 Little-Endian without BOM 的方式來存檔的。

==========================================================
如果想要讓 php 產生的檔案跟 VC 可以互通的話。請使用下列方式:
<?php
$text_1 = "中文ABCDE\r\n";
$fh = fopen("c:\\2.txt", "wb");
fwrite($fh, iconv("UTF-8", "UTF-16LE", $text_1));
fclose($fh);
?>
另外在 <head>section ,加入
<meta equiv="content-type" content="text/html; charset=utf-8">

這樣,格式就可以互通了。

2009年7月8日 星期三

製作還原光碟WePOS

1. Install XP / WePOS.
2. Install Driver.
3. Copy Driver Directory & I386 Directory to HDD.
3.1. I386 ==> c:\windows\I386
3.2. driver ==> c:\drivers
3.3. Adjust resolution.
4. Change install path
4.1. [HKEY_LOCAL_MACHINE]\[SOFTWARE]\[Microsoft]\[Windows]\[CurrentVersion]\[Setup]\Key:[ServicePackSourcePath],Value:[D:\]
4.2. [HKEY_LOCAL_MACHINE]\[SOFTWARE]\[Microsoft]\[Windows]\[CurrentVersion]\[Setup]\Key:[SourcePath],Value:[D:\]
4.3. [HKEY_LOCAL_MACHINE]\[SOFTWARE]\[Microsoft]\[Windows NT]\[CurrentVersion]\Key:[SourcePath],Value:[D:\I386]
5. Packing
5.1. WePOS 1.1 ==> FSreseal
5.2. POSReady2009 ==> Sysprep
6. Follwing setps in another working PC.
7. Clean Recycle bin & memory page file.
8. Start "windows PE tools command prompt".
9. Catch HDD data to image.
9.1. execute "imagex /COMPRESS maximum /capture g: x:\test.wim "test_os""
10. Copy this image to e:\winpe_test\winpe_img\rdata\XXX.wim
11. Make all e:\winpe_test\winpe_img folder data to ISO file.
11.1. execute "oscdimg -bx:\winpe_tool\ETFSBOOT.COM -n -m x:\winpe_img x:\Target.iso"
11.2. -m <== use in case of size large than a CD size.
12. Burn ISO to CD/DVD.