2
0

unicode.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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 roman_to_myanmar() {
  194. var txt = document.getElementById("txtInput").value;
  195. output = "";
  196. try {
  197. for (r_to_m_i in char_roman_to_myn) {
  198. eval("txt=txt.replace(/" + char_roman_to_myn[r_to_m_i].id + "/g,char_roman_to_myn[r_to_m_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 roman_to_tai_tham() {
  212. var txt = document.getElementById("txtInput").value;
  213. output = "";
  214. try {
  215. for (r_to_m_i in char_roman_to_tai) {
  216. eval("txt=txt.replace(/" + char_roman_to_tai[r_to_m_i].id + "/g,char_roman_to_tai[r_to_m_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 roman_to_thai() {
  230. var txt = document.getElementById("txtInput").value;
  231. output = "";
  232. try {
  233. for (r_to_m_i in char_roman_to_thai) {
  234. eval("txt=txt.replace(/" + char_roman_to_thai[r_to_m_i].id + "/g,char_roman_to_thai[r_to_m_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 u2lkcs() {//兰卡简易版
  248. var txt = document.getElementById("txtInput").value;
  249. output = "";
  250. try {
  251. for (u2s_i in char_chinese_pronounce_2) {
  252. eval("txt=txt.replace(/" + char_chinese_pronounce_2[u2s_i].id + "/g,char_chinese_pronounce_2[u2s_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 u2cnnandiya() {
  266. var txt = document.getElementById("txtInput").value;
  267. output = "";
  268. try {
  269. for (u2s_i in char_chinese_pronounce_CN_Nadiya) {
  270. eval("txt=txt.replace(/" + char_chinese_pronounce_CN_Nadiya[u2s_i].id + "/g,char_chinese_pronounce_CN_Nadiya[u2s_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 u2lkpy() {//兰卡拼音版
  284. var txt = " " + document.getElementById("txtInput").value;
  285. output = "";
  286. try {
  287. for (u2s_i in char_chinese_pronounce_pinyin) {
  288. eval("txt=txt.replace(/" + char_chinese_pronounce_pinyin[u2s_i].id + "/g,char_chinese_pronounce_pinyin[u2s_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.toLowerCase();
  297. txt = document.getElementById("txtOutput").value;
  298. u2u()
  299. document.getElementById("txtInput").value = txt;
  300. }
  301. function un2telugu() {
  302. var txt = document.getElementById("txtInput").value;
  303. output = "";
  304. try {
  305. for (u2s_i in char_unicode_to_telugu) {
  306. eval("txt=txt.replace(/" + char_unicode_to_telugu[u2s_i].id + "/g,char_unicode_to_telugu[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 run() {
  320. var input_opt = document.getElementById("input_str").value
  321. var output_opt = document.getElementById("output_str").value
  322. switch (input_opt) {
  323. case "1":
  324. s2u()
  325. break;
  326. case "2":
  327. u2u()
  328. break;
  329. case "3":
  330. sinhala2pali()
  331. break;
  332. case "4":
  333. myanmar_to_roman_1()
  334. break;
  335. case "5":
  336. myanmar_to_roman_2()
  337. break;
  338. }
  339. txt0 = document.getElementById("txtInput").value
  340. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  341. switch (output_opt) {
  342. case "1":
  343. u2s()
  344. break;
  345. case "2":
  346. u2u()
  347. break;
  348. case "3":
  349. b2s()
  350. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  351. u2sinhala1()
  352. break;
  353. case "4":
  354. b2s()
  355. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  356. u2sinhala2()
  357. break;
  358. case "4":
  359. b2s()
  360. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  361. u2lkcd()
  362. break;
  363. case "6":
  364. b2s()
  365. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  366. u2lkcs()
  367. break;
  368. case "7":
  369. b2s()
  370. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  371. u2cnnandiya()
  372. break;
  373. case "8":
  374. b2s()
  375. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  376. u2lkpy()
  377. break;
  378. case "9":
  379. b2s()
  380. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  381. un2telugu()
  382. break;
  383. case "10":
  384. b2s()
  385. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  386. roman_to_myanmar()
  387. break;
  388. case "11":
  389. b2s()
  390. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  391. roman_to_tai_tham()
  392. break;
  393. case "12":
  394. b2s()
  395. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  396. roman_to_thai()
  397. break;
  398. }
  399. document.getElementById("txtInput").value = txt0
  400. }
  401. </script>
  402. <style>
  403. .bg0 {
  404. background-color: #FF9;
  405. }
  406. .bg1 {
  407. background-color: #AAA;
  408. }
  409. </style>
  410. </head>
  411. <body class="mainbody" id="mbody"
  412. 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;">
  413. <!-- tool bar begin-->
  414. <div class='toolbar'>
  415. <script language="javascript">
  416. if (!g_is_mobile) {
  417. document.write("<button id=\"B_Navi\" onclick=\"setNaviVisibility()\" type=\"button\">≡</button> ");
  418. }
  419. </script>
  420. <script language="javascript">
  421. </script>
  422. <span id="debug"></span>
  423. </div>
  424. <!--tool bar end -->
  425. <div class="main" style="width:100%;height:100%;text-align:center; ">
  426. <div style="text-align:center; float:left;width:40%;height:80%;">
  427. My Text Is In<select id="input_str" style="align:center; float:down; font-size: 100%;margin:20px;">
  428. <option value="2">Pāli Roman Unicode</option>
  429. <option value="1">Sangayana</option>
  430. <option value="3">Sinhala</option>
  431. <option value="4">Myanmar1</option>
  432. <option value="5">Myanmar2</option>
  433. </select></br>
  434. <textarea id="txtInput" rows="30" cols=""
  435. style="float:left; font-family: 'Noto Sans','Noto Sans CJK TC', 'Noto Sans CJK SC','Noto Sans Tai Tham', 'ATaiThamKHNewV3-Normal', 'Noto Sans TC', 'Noto Sans SC', 'Noto Sans CJK', Verdana, sans-serif; font-size:16px; width:100%;height:100%;"></textarea>
  436. </div>
  437. <div style="text-align:center; float:left;width:15%;">
  438. </br></br></br></br></br></br></br></br></br></br></br></br>
  439. ṃ/ṁ/ŋ become
  440. <select id="m_str" style="align:center; font-size: 120%">
  441. <option value="ṃ,Ṃ">ṃ</option>
  442. <option value="ṁ,Ṁ">ṁ</option>
  443. <option value="ŋ,Ŋ">ŋ</option>
  444. </select>
  445. </br>
  446. </br>
  447. <button id="transfer" style="align:center; font-size: 200%; width:70px" type="button"
  448. onclick="run()">→</button>
  449. </div>
  450. <div style="text-align:center; float:left;width:40%;height:80%;">
  451. I Need the Text In<select id="output_str" style="align:center; float:down; font-size: 100%;margin:20px;">
  452. <option value="2">Pāli Roman Unicode</option>
  453. <option value="1">Sangayana</option>
  454. <option value="3">Sinhala1</option>
  455. <option value="4">Sinhala2</option>
  456. <option value="5">锡兰注音[详]</option>
  457. <option value="6">锡兰注音[简]</option>
  458. <option value="8">汉语拼音[锡]</option>
  459. <option value="9">Telugu</option>
  460. <option value="10">Myanmar</option>
  461. <option value="11">经典傣文</option>
  462. <option value="12">泰文</option>
  463. </select></br>
  464. <textarea id="txtOutput" rows="30" cols=""
  465. 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>
  466. </div>
  467. <div class="debugMsg" id="xmldata">
  468. <!--调试信息-->
  469. </div>
  470. <!--right side end-->
  471. </div>
  472. <div id="modifywin">
  473. </div>
  474. </body>
  475. </html>