12
2007/4/26 數數數數數數數數數數數數數數數數 Digital Archive Architecture Laboratory 中中中中中中中中中中中中中中 ~ 中中中中中中中中 中中中 中中中

中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

  • Upload
    wendi

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術. 報告人:林金龍. outline. 構字式 ( 缺字 ) 輸入 資料庫處理 構字式 ( 缺字 ) 呈現. 構字式 ( 缺字 ) 輸入. 漢字構形資料庫 缺字查詢系統 (Web). 漢字構形資料庫. 1. 查詢. 3. 構字式. 2. 查詢結果. 缺字查詢系統 (Web). 1. 查詢. 2. 查詢結果. 3. 構字式. 4. 快速複製至剪貼簿. 缺字查詢系統 (Web). 資料庫處理. 典藏系統編碼 Big5 資料庫編碼 Big5 構字式轉 unicode 跳脫字元 JAVA Bean. - PowerPoint PPT Presentation

Citation preview

Page 1: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

2007/4/26

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

中文缺字在數位典藏系統之應用~網頁缺字處理技術

報告人:林金龍

Page 2: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

outline

構字式 (缺字 )輸入資料庫處理構字式 (缺字 )呈現

Page 3: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

構字式 (缺字 )輸入

漢字構形資料庫缺字查詢系統(Web)

Page 4: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

漢字構形資料庫

1.查詢

2.查詢結果

3.構字式

Page 5: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

缺字查詢系統 (Web)

1.查詢

2.查詢結果

3.構字式4.快速複製至剪貼簿

Page 6: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

缺字查詢系統 (Web)

Page 7: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

資料庫處理

典藏系統編碼• Big5

資料庫編碼• Big5

構字式轉 unicode跳脫字元• JAVA Bean

Page 8: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

構字式轉 unicode跳脫字元public String getCode(String OriStr) {

StringBuffer sb = new StringBuffer(); byte[] byteOriStr = OriStr.getBytes("ISO-8859-1"); int hiByte; int loByte; for (int k = 0; k < byteOriStr.length; k++) {

if (byteOriStr[k] < 0 && k < byteOriStr.length - 1) { // 非英數字 hiByte = byteOriStr[k]; loByte = byteOriStr[k + 1]; hiByte = (hiByte > 0) ? (hiByte) : (hiByte & 0xFF); // 轉為 正值 loByte = (loByte > 0) ? (loByte) : (loByte & 0xFF); int big5code = hiByte * 256 + loByte; // Big 5 碼 if (hiByte == 0xF9 && loByte > 0xD5 && loByte < 0xFF) { // 判斷是否為倚天擴充字與特殊字碼區

sb.append(getETCode(loByte)); } // if () 倚天字碼區 else if ( (big5code >= 0x8140 && big5code <= 0x8DFE) || (big5code >= 0x8E40 && big5code <= 0xA0FE) || (big5code >= 0xC6A1 && big5code <= 0xC8FE) || (big5code >= 0xFA40 && big5code <= 0xFEFE)) { // 判斷是否為中文造字區 sb.append(getMissCharCode(hiByte, loByte)); } // if () 中文造字區 else { // 其它 - 一般中文 byte dbcs[] = new byte[2]; dbcs[0] = byteOriStr[k]; dbcs[1] = byteOriStr[k + 1]; sb.append(new String(dbcs)); } k++;}else { // 英數字 sb.append( (char) byteOriStr[k]);}

} // for(int k = 0; k < OriStr.length(); k++)}return sb.toString();

}

Page 9: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

構字式轉 unicode跳脫字元 (cont.1)

private String getETCode(int loByte) { String ETCode = ""; switch (loByte) { case 0xD6: ETCode = "&#x7881;"; break; case 0xD7: ETCode = "&#x92B9;"; break; . . .

case 0xFE: ETCode = "&#x2593;"; break; default: break; } // switch () return ETCode; }

Page 10: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

構字式轉 unicode跳脫字元 (cont.2)

private String getMissCharCode(int hiByte, int loByte) { String MissCharCode = ""; int big5code = hiByte * 256 + loByte; int MISS_CHAR_BASE = 0; int MISS_CHAR_START = 0;

if (hiByte >= 0x81 && hiByte <= 0x8D) { MISS_CHAR_BASE = 0x6D78; MISS_CHAR_START = 0x81; } else if (hiByte >= 0x8E && hiByte <= 0xA0) { MISS_CHAR_BASE = 0x54D1; MISS_CHAR_START = 0x8E; } else if (hiByte >= 0xC6 && hiByte <= 0xC8) { MISS_CHAR_BASE = 0x3032; MISS_CHAR_START = 0xC6; } else if (hiByte >= 0xFA && hiByte <= 0xFE) { MISS_CHAR_BASE = -0x1A40; MISS_CHAR_START = 0xFA; }

int offset = MISS_CHAR_BASE - 0x63 * (hiByte - MISS_CHAR_START);

if (loByte >= 0xA1 && loByte <= 0xFE) { offset = offset - 0x22; }

int unicode = big5code + offset; MissCharCode = "&#x" + (Integer.toHexString(unicode)).toUpperCase() + ";"; return MissCharCode; }}

Page 11: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

構字式 (缺字 )呈現

網頁處理• Java Applet• Java Script • Java Bean

缺字圖型產生程式• CGI• C#

Page 12: 中文缺字在數位典藏系統之應用 ~ 網頁缺字處理技術

數位典藏國家型科技計畫技術發展組Digital Archive Architecture Laboratory

Q & A