unicode.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Paḷi Code Transfer</title>
  6. <link type="text/css" rel="stylesheet" href="../pcdl/css/font.css">
  7. <script language="javascript" src="js/vn.js"></script>
  8. <script language="javascript" src="js/xml.js"></script>
  9. <script language="javascript" src="js/filenew.js"></script>
  10. <script language="javascript" src="js/editor.js"></script>
  11. <script language="javascript" src="../public/charcode/sinhala.js"></script>
  12. <script language="javascript" src="../public/charcode/unicode.js"></script>
  13. <script language="javascript" src="../public/charcode/myanmar.js"></script>
  14. <script language="javascript" src="../public/charcode/tai_tham.js"></script>
  15. <script language="javascript" src="../public/charcode/thai.js"></script>
  16. <script language="javascript">
  17. function sangayana2unicode(inStr, inM, inM2) {
  18. var output = inStr;
  19. output = output.replace(/ïk/g, inM + "k");
  20. output = output.replace(/ïg/g, inM + "g");
  21. output = output.replace(/ü/g, inM);
  22. output = output.replace(/§/g, inM);
  23. output = output.replace(/ṃ/g, inM);
  24. output = output.replace(/ðK/g, inM2 + "K");
  25. output = output.replace(/ðG/g, inM2 + "G");
  26. output = output.replace(/ý/g, inM2);
  27. for (unicode_i in char_sanga_to_unicode) {
  28. eval("output=output.replace(/" + char_sanga_to_unicode[unicode_i].id + "/g,char_sanga_to_unicode[unicode_i].value);");
  29. }
  30. return (output);
  31. }
  32. function s2u() {
  33. mstr = document.getElementById("m_str").value;
  34. mlower = mstr.split(",")[0];
  35. mupper = mstr.split(",")[1];
  36. txt = document.getElementById("txtInput").value;
  37. document.getElementById("txtOutput").value = sangayana2unicode(txt, mlower, mupper);
  38. }
  39. function unicode2sangayana(inStr, inM, inM2) {
  40. var output = inStr;
  41. for (unicode_i in char_unicode_to_sanga) {
  42. eval("output=output.replace(/" + char_unicode_to_sanga[unicode_i].id + "/g,char_unicode_to_sanga[unicode_i].value);");
  43. }
  44. return (output);
  45. }
  46. function u2s() {
  47. mstr = document.getElementById("m_str").value;
  48. mlower = mstr.split(",")[0];
  49. mupper = mstr.split(",")[1];
  50. txt = " " + document.getElementById("txtInput").value;
  51. document.getElementById("txtOutput").value = unicode2sangayana(txt, mlower, mupper);
  52. }
  53. function sinhala2pali() {
  54. var txt = document.getElementById("txtInput").value;
  55. output = "";
  56. try {
  57. for (u2s_i in char_si_to_unicode) {
  58. eval("txt=txt.replace(/" + char_si_to_unicode[u2s_i].id + "/g,char_si_to_unicode[u2s_i].value);");
  59. }
  60. }
  61. catch (err) {
  62. //error
  63. alert(err.message);
  64. }
  65. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  66. document.getElementById("txtInput").value = txt;
  67. txt = document.getElementById("txtOutput").value;
  68. u2u()
  69. document.getElementById("txtInput").value = txt;
  70. }
  71. function u2sinhala1() {
  72. var txt = document.getElementById("txtInput").value;
  73. output = "";
  74. try {
  75. for (u2s_i in char_unicode_to_si_c) {
  76. eval("txt=txt.replace(/" + char_unicode_to_si_c[u2s_i].id + "/g,char_unicode_to_si_c[u2s_i].value);");
  77. }
  78. }
  79. catch (err) {
  80. //error
  81. alert(err.message);
  82. }
  83. document.getElementById("txtOutput").value = txt;
  84. }
  85. function u2sinhala2() {
  86. var txt = document.getElementById("txtInput").value;
  87. output = "";
  88. try {
  89. for (u2s_i in char_unicode_to_si_n) {
  90. eval("txt=txt.replace(/" + char_unicode_to_si_n[u2s_i].id + "/g,char_unicode_to_si_n[u2s_i].value);");
  91. }
  92. }
  93. catch (err) {
  94. //error
  95. alert(err.message);
  96. }
  97. document.getElementById("txtOutput").value = txt;
  98. }
  99. function unicode2unicode(inStr, inM, inM2) {
  100. var output = inStr;
  101. output = output.replace(/ṅk/g, inM + "k");
  102. output = output.replace(/ṅg/g, inM + "g");
  103. output = output.replace(/ŋk/g, inM + "k");
  104. output = output.replace(/ŋg/g, inM + "g");
  105. output = output.replace(/ŋ/g, inM);
  106. output = output.replace(/ṁ/g, inM);
  107. output = output.replace(/ṃ/g, inM);
  108. output = output.replace(/ṃk/g, "ṅk");
  109. output = output.replace(/ṁk/g, "ṅk");
  110. output = output.replace(/ṃg/g, "ṅg");
  111. output = output.replace(/ṁg/g, "ṅg");
  112. output = output.replace(/ṄK/g, inM2 + "K");
  113. output = output.replace(/ṄG/g, inM2 + "G");
  114. output = output.replace(/ŊK/g, inM2 + "K");
  115. output = output.replace(/ŊG/g, inM2 + "G");
  116. output = output.replace(/Ŋ/g, inM2);
  117. output = output.replace(/Ṁ/g, inM2);
  118. output = output.replace(/Ṃ/g, inM2);
  119. output = output.replace(/ṂK/g, "ṄG");
  120. output = output.replace(/ṀK/g, "ṄG");
  121. output = output.replace(/ṂG/g, "ṄG");
  122. output = output.replace(/ṀG/g, "ṄG");
  123. return (output);
  124. }
  125. function u2u() {
  126. mstr = document.getElementById("m_str").value;
  127. mlower = mstr.split(",")[0];
  128. mupper = mstr.split(",")[1];
  129. txt = document.getElementById("txtInput").value;
  130. document.getElementById("txtOutput").value = unicode2unicode(txt, mlower, mupper);
  131. }
  132. function b2s() {
  133. mstr = document.getElementById("m_str").value;
  134. mlower = mstr.split(",")[0];
  135. mupper = mstr.split(",")[1];
  136. txt = document.getElementById("txtInput").value;
  137. document.getElementById("txtOutput").value = txt.toLowerCase();
  138. }
  139. function u2lkcd() {//兰卡详尽版
  140. var txt = document.getElementById("txtInput").value;
  141. output = "";
  142. try {
  143. for (u2s_i in char_chinese_pronounce_1) {
  144. eval("txt=txt.replace(/" + char_chinese_pronounce_1[u2s_i].id + "/g,char_chinese_pronounce_1[u2s_i].value);");
  145. }
  146. }
  147. catch (err) {
  148. //error
  149. alert(err.message);
  150. }
  151. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  152. document.getElementById("txtInput").value = txt;
  153. txt = document.getElementById("txtOutput").value;
  154. u2u()
  155. document.getElementById("txtInput").value = txt;
  156. }
  157. function myanmar_to_roman_1() {
  158. var txt = document.getElementById("txtInput").value;
  159. output = "";
  160. try {
  161. for (m_to_r_i in char_myn_to_roman_1) {
  162. eval("txt=txt.replace(/" + char_myn_to_roman_1[m_to_r_i].id + "/g,char_myn_to_roman_1[m_to_r_i].value);");
  163. }
  164. }
  165. catch (err) {
  166. //error
  167. alert(err.message);
  168. }
  169. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  170. document.getElementById("txtInput").value = txt;
  171. txt = document.getElementById("txtOutput").value;
  172. u2u()
  173. document.getElementById("txtInput").value = txt;
  174. }
  175. function myanmar_to_roman_2() {
  176. var txt = document.getElementById("txtInput").value;
  177. output = "";
  178. try {
  179. for (m_to_r_i in char_myn_to_roman_2) {
  180. eval("txt=txt.replace(/" + char_myn_to_roman_2[m_to_r_i].id + "/g,char_myn_to_roman_2[m_to_r_i].value);");
  181. }
  182. }
  183. catch (err) {
  184. //error
  185. alert(err.message);
  186. }
  187. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  188. document.getElementById("txtInput").value = txt;
  189. txt = document.getElementById("txtOutput").value;
  190. u2u()
  191. document.getElementById("txtInput").value = txt;
  192. }
  193. function tai_tham_to_roman() {
  194. var txt = document.getElementById("txtInput").value;
  195. output = "";
  196. try {
  197. for (tai_to_r_i in char_tai_to_roman) {
  198. eval("txt=txt.replace(/" + char_tai_to_roman[tai_to_r_i].id + "/g,char_tai_to_roman[tai_to_r_i].value);");
  199. }
  200. }
  201. catch (err) {
  202. //error
  203. alert(err.message);
  204. }
  205. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  206. document.getElementById("txtInput").value = txt;
  207. txt = document.getElementById("txtOutput").value;
  208. u2u()
  209. document.getElementById("txtInput").value = txt;
  210. }
  211. function tai_old_to_roman() {
  212. var txt = document.getElementById("txtInput").value;
  213. output = "";
  214. try {
  215. for (tai_o_to_r_i in char_tai_old_to_r) {
  216. eval("txt=txt.replace(/" + char_tai_old_to_r[tai_o_to_r_i].id + "/g,char_tai_old_to_r[tai_o_to_r_i].value);");
  217. }
  218. }
  219. catch (err) {
  220. //error
  221. alert(err.message);
  222. }
  223. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  224. document.getElementById("txtInput").value = txt;
  225. txt = document.getElementById("txtOutput").value;
  226. u2u()
  227. document.getElementById("txtInput").value = txt;
  228. }
  229. function thai_to_roman() {
  230. var txt = document.getElementById("txtInput").value;
  231. output = "";
  232. try {
  233. for (thai_to_r_i in char_thai_to_roman) {
  234. eval("txt=txt.replace(/" + char_thai_to_roman[thai_to_r_i].id + "/g,char_thai_to_roman[thai_to_r_i].value);");
  235. }
  236. }
  237. catch (err) {
  238. //error
  239. alert(err.message);
  240. }
  241. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  242. document.getElementById("txtInput").value = txt;
  243. txt = document.getElementById("txtOutput").value;
  244. u2u()
  245. document.getElementById("txtInput").value = txt;
  246. }
  247. function roman_to_myanmar() {
  248. var txt = document.getElementById("txtInput").value;
  249. output = "";
  250. try {
  251. for (r_to_m_i in char_roman_to_myn) {
  252. eval("txt=txt.replace(/" + char_roman_to_myn[r_to_m_i].id + "/g,char_roman_to_myn[r_to_m_i].value);");
  253. }
  254. }
  255. catch (err) {
  256. //error
  257. alert(err.message);
  258. }
  259. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  260. document.getElementById("txtInput").value = txt;
  261. txt = document.getElementById("txtOutput").value;
  262. u2u()
  263. document.getElementById("txtInput").value = txt;
  264. }
  265. function roman_to_tai_tham() {
  266. var txt = document.getElementById("txtInput").value;
  267. output = "";
  268. try {
  269. for (r_to_m_i in char_roman_to_tai) {
  270. eval("txt=txt.replace(/" + char_roman_to_tai[r_to_m_i].id + "/g,char_roman_to_tai[r_to_m_i].value);");
  271. }
  272. }
  273. catch (err) {
  274. //error
  275. alert(err.message);
  276. }
  277. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  278. document.getElementById("txtInput").value = txt;
  279. txt = document.getElementById("txtOutput").value;
  280. u2u()
  281. document.getElementById("txtInput").value = txt;
  282. }
  283. function roman_to_thai() {
  284. var txt = document.getElementById("txtInput").value;
  285. output = "";
  286. try {
  287. for (r_to_m_i in char_roman_to_thai) {
  288. eval("txt=txt.replace(/" + char_roman_to_thai[r_to_m_i].id + "/g,char_roman_to_thai[r_to_m_i].value);");
  289. }
  290. }
  291. catch (err) {
  292. //error
  293. alert(err.message);
  294. }
  295. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  296. document.getElementById("txtInput").value = txt;
  297. txt = document.getElementById("txtOutput").value;
  298. u2u()
  299. document.getElementById("txtInput").value = txt;
  300. }
  301. function u2lkcs() {//兰卡简易版
  302. var txt = document.getElementById("txtInput").value;
  303. output = "";
  304. try {
  305. for (u2s_i in char_chinese_pronounce_2) {
  306. eval("txt=txt.replace(/" + char_chinese_pronounce_2[u2s_i].id + "/g,char_chinese_pronounce_2[u2s_i].value);");
  307. }
  308. }
  309. catch (err) {
  310. //error
  311. alert(err.message);
  312. }
  313. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  314. document.getElementById("txtInput").value = txt;
  315. txt = document.getElementById("txtOutput").value;
  316. u2u()
  317. document.getElementById("txtInput").value = txt;
  318. }
  319. function u2cnnandiya() {
  320. var txt = document.getElementById("txtInput").value;
  321. output = "";
  322. try {
  323. for (u2s_i in char_chinese_pronounce_CN_Nadiya) {
  324. eval("txt=txt.replace(/" + char_chinese_pronounce_CN_Nadiya[u2s_i].id + "/g,char_chinese_pronounce_CN_Nadiya[u2s_i].value);");
  325. }
  326. }
  327. catch (err) {
  328. //error
  329. alert(err.message);
  330. }
  331. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  332. document.getElementById("txtInput").value = txt;
  333. txt = document.getElementById("txtOutput").value;
  334. u2u()
  335. document.getElementById("txtInput").value = txt;
  336. }
  337. function u2lkpy() {//兰卡拼音版
  338. var txt = " " + document.getElementById("txtInput").value;
  339. output = "";
  340. try {
  341. for (u2s_i in char_chinese_pronounce_pinyin) {
  342. eval("txt=txt.replace(/" + char_chinese_pronounce_pinyin[u2s_i].id + "/g,char_chinese_pronounce_pinyin[u2s_i].value);");
  343. }
  344. }
  345. catch (err) {
  346. //error
  347. alert(err.message);
  348. }
  349. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  350. document.getElementById("txtInput").value = txt.toLowerCase();
  351. txt = document.getElementById("txtOutput").value;
  352. u2u()
  353. document.getElementById("txtInput").value = txt;
  354. }
  355. function un2telugu() {
  356. var txt = document.getElementById("txtInput").value;
  357. output = "";
  358. try {
  359. for (u2s_i in char_unicode_to_telugu) {
  360. eval("txt=txt.replace(/" + char_unicode_to_telugu[u2s_i].id + "/g,char_unicode_to_telugu[u2s_i].value);");
  361. }
  362. }
  363. catch (err) {
  364. //error
  365. alert(err.message);
  366. }
  367. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  368. document.getElementById("txtInput").value = txt;
  369. txt = document.getElementById("txtOutput").value;
  370. u2u()
  371. document.getElementById("txtInput").value = txt;
  372. }
  373. function run() {
  374. var input_opt = document.getElementById("input_str").value
  375. var output_opt = document.getElementById("output_str").value
  376. switch (input_opt) {
  377. case "1":
  378. s2u()
  379. break;
  380. case "2":
  381. u2u()
  382. break;
  383. case "3":
  384. sinhala2pali()
  385. break;
  386. case "4":
  387. myanmar_to_roman_1()
  388. break;
  389. case "6":
  390. tai_tham_to_roman()
  391. break;
  392. case "7":
  393. thai_to_roman()
  394. break;
  395. case "8":
  396. tai_old_to_roman()
  397. break;
  398. }
  399. txt0 = document.getElementById("txtInput").value
  400. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  401. switch (output_opt) {
  402. case "1":
  403. u2s()
  404. break;
  405. case "2":
  406. u2u()
  407. break;
  408. case "3":
  409. b2s()
  410. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  411. u2sinhala1()
  412. break;
  413. case "4":
  414. b2s()
  415. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  416. u2sinhala2()
  417. break;
  418. case "4":
  419. b2s()
  420. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  421. u2lkcd()
  422. break;
  423. case "6":
  424. b2s()
  425. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  426. u2lkcs()
  427. break;
  428. case "7":
  429. b2s()
  430. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  431. u2cnnandiya()
  432. break;
  433. case "8":
  434. b2s()
  435. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  436. u2lkpy()
  437. break;
  438. case "9":
  439. b2s()
  440. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  441. un2telugu()
  442. break;
  443. case "10":
  444. b2s()
  445. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  446. roman_to_myanmar()
  447. break;
  448. case "11":
  449. b2s()
  450. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  451. roman_to_tai_tham()
  452. break;
  453. case "12":
  454. b2s()
  455. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  456. roman_to_thai()
  457. break;
  458. }
  459. document.getElementById("txtInput").value = txt0
  460. }
  461. </script>
  462. <style>
  463. .bg0 {
  464. background-color: #FF9;
  465. }
  466. .bg1 {
  467. background-color: #AAA;
  468. }
  469. </style>
  470. </head>
  471. <body class="mainbody" id="mbody"
  472. style="font-family: 'Noto Sans','Noto Sans CJK TC', 'Noto Sans CJK SC', 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans CJK', Verdana, sans-serif; font-size:18px;">
  473. <!-- tool bar begin-->
  474. <div class='toolbar'>
  475. <script language="javascript">
  476. if (!g_is_mobile) {
  477. document.write("<button id=\"B_Navi\" onclick=\"setNaviVisibility()\" type=\"button\">≡</button> ");
  478. }
  479. </script>
  480. <script language="javascript">
  481. </script>
  482. <span id="debug"></span>
  483. </div>
  484. <!--tool bar end -->
  485. <div class="main" style="width:100%;height:100%;text-align:center; ">
  486. <div style="text-align:center; float:left;width:40%;height:80%;">
  487. My Text Is In<select id="input_str" style="align:center; float:down; font-size: 100%;margin:20px;">
  488. <option value="2">Pāli Roman Unicode</option>
  489. <option value="1">Sangayana</option>
  490. <option value="3">Sinhala</option>
  491. <option value="4">Myanmar1</option>
  492. <option value="5">Myanmar2</option>
  493. <option value="6">经典傣文</option>
  494. <option value="7">泰文</option>
  495. <option value="8">非Unicode傣文</option>
  496. </select></br>
  497. <textarea id="txtInput" rows="30" cols=""
  498. style="float:left; font-family: 'Noto Sans','Noto Sans CJK TC', 'Noto Sans CJK SC', 'ATaiThamKHNewV3-Normal', 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans CJK', Verdana, sans-serif; font-size:16px; width:100%;height:100%;"></textarea>
  499. </div>
  500. <div style="text-align:center; float:left;width:15%;">
  501. </br></br></br></br></br></br></br></br></br></br></br></br>
  502. ṃ/ṁ/ŋ become
  503. <select id="m_str" style="align:center; font-size: 120%">
  504. <option value="ṃ,Ṃ">ṃ</option>
  505. <option value="ṁ,Ṁ">ṁ</option>
  506. <option value="ŋ,Ŋ">ŋ</option>
  507. </select>
  508. </br>
  509. </br>
  510. <button id="transfer" style="align:center; font-size: 200%; width:70px" type="button"
  511. onclick="run()">→</button>
  512. </div>
  513. <div style="text-align:center; float:left;width:40%;height:80%;">
  514. I Need the Text In<select id="output_str" style="align:center; float:down; font-size: 100%;margin:20px;">
  515. <option value="2">Pāli Roman Unicode</option>
  516. <option value="1">Sangayana</option>
  517. <option value="3">Sinhala1</option>
  518. <option value="4">Sinhala2</option>
  519. <option value="5">锡兰注音[详]</option>
  520. <option value="6">锡兰注音[简]</option>
  521. <option value="8">汉语拼音[锡]</option>
  522. <option value="9">Telugu</option>
  523. <option value="10">Myanmar</option>
  524. <option value="11">经典傣文</option>
  525. <option value="12">泰文</option>
  526. </select></br>
  527. <textarea id="txtOutput" rows="30" cols=""
  528. style="font-family: 'Noto Sans','Noto Sans CJK TC', 'Noto Sans CJK SC', 'ATaiThamKHNewV3-Normal', 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans CJK', Verdana, sans-serif; font-size:16px; width:100%;height:100%"></textarea>
  529. </div>
  530. <div class="debugMsg" id="xmldata">
  531. <!--调试信息-->
  532. </div>
  533. <!--right side end-->
  534. </div>
  535. <div id="modifywin">
  536. </div>
  537. </body>
  538. </html>