unicode.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  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">
  16. function sangayana2unicode(inStr, inM, inM2) {
  17. var output = inStr;
  18. output = output.replace(/ïk/g, inM + "k");
  19. output = output.replace(/ïg/g, inM + "g");
  20. output = output.replace(/ü/g, inM);
  21. output = output.replace(/§/g, inM);
  22. output = output.replace(/ṃ/g, inM);
  23. output = output.replace(/ðK/g, inM2 + "K");
  24. output = output.replace(/ðG/g, inM2 + "G");
  25. output = output.replace(/ý/g, inM2);
  26. for (unicode_i in char_sanga_to_unicode) {
  27. eval("output=output.replace(/" + char_sanga_to_unicode[unicode_i].id + "/g,char_sanga_to_unicode[unicode_i].value);");
  28. }
  29. return (output);
  30. }
  31. function s2u() {
  32. mstr = document.getElementById("m_str").value;
  33. mlower = mstr.split(",")[0];
  34. mupper = mstr.split(",")[1];
  35. txt = document.getElementById("txtInput").value;
  36. document.getElementById("txtOutput").value = sangayana2unicode(txt, mlower, mupper);
  37. }
  38. function unicode2sangayana(inStr, inM, inM2) {
  39. var output = inStr;
  40. for (unicode_i in char_unicode_to_sanga) {
  41. eval("output=output.replace(/" + char_unicode_to_sanga[unicode_i].id + "/g,char_unicode_to_sanga[unicode_i].value);");
  42. }
  43. return (output);
  44. }
  45. function u2s() {
  46. mstr = document.getElementById("m_str").value;
  47. mlower = mstr.split(",")[0];
  48. mupper = mstr.split(",")[1];
  49. txt = " " + document.getElementById("txtInput").value;
  50. document.getElementById("txtOutput").value = unicode2sangayana(txt, mlower, mupper);
  51. }
  52. function sinhala2pali() {
  53. var txt = document.getElementById("txtInput").value;
  54. output = "";
  55. try {
  56. for (u2s_i in char_si_to_unicode) {
  57. eval("txt=txt.replace(/" + char_si_to_unicode[u2s_i].id + "/g,char_si_to_unicode[u2s_i].value);");
  58. }
  59. }
  60. catch (err) {
  61. //error
  62. alert(err.message);
  63. }
  64. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  65. document.getElementById("txtInput").value = txt;
  66. txt = document.getElementById("txtOutput").value;
  67. u2u()
  68. document.getElementById("txtInput").value = txt;
  69. }
  70. function u2sinhala1() {
  71. var txt = document.getElementById("txtInput").value;
  72. output = "";
  73. try {
  74. for (u2s_i in char_unicode_to_si_c) {
  75. eval("txt=txt.replace(/" + char_unicode_to_si_c[u2s_i].id + "/g,char_unicode_to_si_c[u2s_i].value);");
  76. }
  77. }
  78. catch (err) {
  79. //error
  80. alert(err.message);
  81. }
  82. document.getElementById("txtOutput").value = txt;
  83. }
  84. function u2sinhala2() {
  85. var txt = document.getElementById("txtInput").value;
  86. output = "";
  87. try {
  88. for (u2s_i in char_unicode_to_si_n) {
  89. eval("txt=txt.replace(/" + char_unicode_to_si_n[u2s_i].id + "/g,char_unicode_to_si_n[u2s_i].value);");
  90. }
  91. }
  92. catch (err) {
  93. //error
  94. alert(err.message);
  95. }
  96. document.getElementById("txtOutput").value = txt;
  97. }
  98. function unicode2unicode(inStr, inM, inM2) {
  99. var output = inStr;
  100. output = output.replace(/ṅk/g, inM + "k");
  101. output = output.replace(/ṅg/g, inM + "g");
  102. output = output.replace(/ŋk/g, inM + "k");
  103. output = output.replace(/ŋg/g, inM + "g");
  104. output = output.replace(/ŋ/g, inM);
  105. output = output.replace(/ṁ/g, inM);
  106. output = output.replace(/ṃ/g, inM);
  107. output = output.replace(/ṃk/g, "ṅk");
  108. output = output.replace(/ṁk/g, "ṅk");
  109. output = output.replace(/ṃg/g, "ṅg");
  110. output = output.replace(/ṁg/g, "ṅg");
  111. output = output.replace(/ṄK/g, inM2 + "K");
  112. output = output.replace(/ṄG/g, inM2 + "G");
  113. output = output.replace(/ŊK/g, inM2 + "K");
  114. output = output.replace(/ŊG/g, inM2 + "G");
  115. output = output.replace(/Ŋ/g, inM2);
  116. output = output.replace(/Ṁ/g, inM2);
  117. output = output.replace(/Ṃ/g, inM2);
  118. output = output.replace(/ṂK/g, "ṄG");
  119. output = output.replace(/ṀK/g, "ṄG");
  120. output = output.replace(/ṂG/g, "ṄG");
  121. output = output.replace(/ṀG/g, "ṄG");
  122. return (output);
  123. }
  124. function u2u() {
  125. mstr = document.getElementById("m_str").value;
  126. mlower = mstr.split(",")[0];
  127. mupper = mstr.split(",")[1];
  128. txt = document.getElementById("txtInput").value;
  129. document.getElementById("txtOutput").value = unicode2unicode(txt, mlower, mupper);
  130. }
  131. function b2s() {
  132. mstr = document.getElementById("m_str").value;
  133. mlower = mstr.split(",")[0];
  134. mupper = mstr.split(",")[1];
  135. txt = document.getElementById("txtInput").value;
  136. document.getElementById("txtOutput").value = txt.toLowerCase();
  137. }
  138. function u2lkcd() {//兰卡详尽版
  139. var txt = document.getElementById("txtInput").value;
  140. output = "";
  141. try {
  142. for (u2s_i in char_chinese_pronounce_1) {
  143. eval("txt=txt.replace(/" + char_chinese_pronounce_1[u2s_i].id + "/g,char_chinese_pronounce_1[u2s_i].value);");
  144. }
  145. }
  146. catch (err) {
  147. //error
  148. alert(err.message);
  149. }
  150. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  151. document.getElementById("txtInput").value = txt;
  152. txt = document.getElementById("txtOutput").value;
  153. u2u()
  154. document.getElementById("txtInput").value = txt;
  155. }
  156. function myanmar_to_roman_1() {
  157. var txt = document.getElementById("txtInput").value;
  158. output = "";
  159. try {
  160. for (m_to_r_i in char_myn_to_roman_1) {
  161. 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);");
  162. }
  163. }
  164. catch (err) {
  165. //error
  166. alert(err.message);
  167. }
  168. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  169. document.getElementById("txtInput").value = txt;
  170. txt = document.getElementById("txtOutput").value;
  171. u2u()
  172. document.getElementById("txtInput").value = txt;
  173. }
  174. function myanmar_to_roman_2() {
  175. var txt = document.getElementById("txtInput").value;
  176. output = "";
  177. try {
  178. for (m_to_r_i in char_myn_to_roman_2) {
  179. 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);");
  180. }
  181. }
  182. catch (err) {
  183. //error
  184. alert(err.message);
  185. }
  186. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  187. document.getElementById("txtInput").value = txt;
  188. txt = document.getElementById("txtOutput").value;
  189. u2u()
  190. document.getElementById("txtInput").value = txt;
  191. }
  192. function roman_to_myanmar() {
  193. var txt = document.getElementById("txtInput").value;
  194. output = "";
  195. try {
  196. for (r_to_m_i in char_roman_to_myn) {
  197. eval("txt=txt.replace(/" + char_roman_to_myn[r_to_m_i].id + "/g,char_roman_to_myn[r_to_m_i].value);");
  198. }
  199. }
  200. catch (err) {
  201. //error
  202. alert(err.message);
  203. }
  204. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  205. document.getElementById("txtInput").value = txt;
  206. txt = document.getElementById("txtOutput").value;
  207. u2u()
  208. document.getElementById("txtInput").value = txt;
  209. }
  210. function roman_to_tai_tham() {
  211. var txt = document.getElementById("txtInput").value;
  212. output = "";
  213. try {
  214. for (r_to_m_i in char_roman_to_tai) {
  215. eval("txt=txt.replace(/" + char_roman_to_tai[r_to_m_i].id + "/g,char_roman_to_tai[r_to_m_i].value);");
  216. }
  217. }
  218. catch (err) {
  219. //error
  220. alert(err.message);
  221. }
  222. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  223. document.getElementById("txtInput").value = txt;
  224. txt = document.getElementById("txtOutput").value;
  225. u2u()
  226. document.getElementById("txtInput").value = txt;
  227. }
  228. function u2lkcs() {//兰卡简易版
  229. var txt = document.getElementById("txtInput").value;
  230. output = "";
  231. try {
  232. for (u2s_i in char_chinese_pronounce_2) {
  233. eval("txt=txt.replace(/" + char_chinese_pronounce_2[u2s_i].id + "/g,char_chinese_pronounce_2[u2s_i].value);");
  234. }
  235. }
  236. catch (err) {
  237. //error
  238. alert(err.message);
  239. }
  240. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  241. document.getElementById("txtInput").value = txt;
  242. txt = document.getElementById("txtOutput").value;
  243. u2u()
  244. document.getElementById("txtInput").value = txt;
  245. }
  246. function u2cnnandiya() {
  247. var txt = document.getElementById("txtInput").value;
  248. output = "";
  249. try {
  250. for (u2s_i in char_chinese_pronounce_CN_Nadiya) {
  251. eval("txt=txt.replace(/" + char_chinese_pronounce_CN_Nadiya[u2s_i].id + "/g,char_chinese_pronounce_CN_Nadiya[u2s_i].value);");
  252. }
  253. }
  254. catch (err) {
  255. //error
  256. alert(err.message);
  257. }
  258. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  259. document.getElementById("txtInput").value = txt;
  260. txt = document.getElementById("txtOutput").value;
  261. u2u()
  262. document.getElementById("txtInput").value = txt;
  263. }
  264. function u2lkpy() {//兰卡拼音版
  265. var txt = " " + document.getElementById("txtInput").value;
  266. output = "";
  267. try {
  268. for (u2s_i in char_chinese_pronounce_pinyin) {
  269. eval("txt=txt.replace(/" + char_chinese_pronounce_pinyin[u2s_i].id + "/g,char_chinese_pronounce_pinyin[u2s_i].value);");
  270. }
  271. }
  272. catch (err) {
  273. //error
  274. alert(err.message);
  275. }
  276. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  277. document.getElementById("txtInput").value = txt.toLowerCase();
  278. txt = document.getElementById("txtOutput").value;
  279. u2u()
  280. document.getElementById("txtInput").value = txt;
  281. }
  282. function un2telugu() {
  283. var txt = document.getElementById("txtInput").value;
  284. output = "";
  285. try {
  286. for (u2s_i in char_unicode_to_telugu) {
  287. eval("txt=txt.replace(/" + char_unicode_to_telugu[u2s_i].id + "/g,char_unicode_to_telugu[u2s_i].value);");
  288. }
  289. }
  290. catch (err) {
  291. //error
  292. alert(err.message);
  293. }
  294. document.getElementById("txtOutput").value = document.getElementById("txtInput").value;
  295. document.getElementById("txtInput").value = txt;
  296. txt = document.getElementById("txtOutput").value;
  297. u2u()
  298. document.getElementById("txtInput").value = txt;
  299. }
  300. function run() {
  301. var input_opt = document.getElementById("input_str").value
  302. var output_opt = document.getElementById("output_str").value
  303. switch (input_opt) {
  304. case "1":
  305. s2u()
  306. break;
  307. case "2":
  308. u2u()
  309. break;
  310. case "3":
  311. sinhala2pali()
  312. break;
  313. case "4":
  314. myanmar_to_roman_1()
  315. break;
  316. case "5":
  317. myanmar_to_roman_2()
  318. break;
  319. }
  320. txt0 = document.getElementById("txtInput").value
  321. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  322. switch (output_opt) {
  323. case "1":
  324. u2s()
  325. break;
  326. case "2":
  327. u2u()
  328. break;
  329. case "3":
  330. b2s()
  331. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  332. u2sinhala1()
  333. break;
  334. case "4":
  335. b2s()
  336. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  337. u2sinhala2()
  338. break;
  339. case "4":
  340. b2s()
  341. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  342. u2lkcd()
  343. break;
  344. case "6":
  345. b2s()
  346. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  347. u2lkcs()
  348. break;
  349. case "7":
  350. b2s()
  351. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  352. u2cnnandiya()
  353. break;
  354. case "8":
  355. b2s()
  356. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  357. u2lkpy()
  358. break;
  359. case "9":
  360. b2s()
  361. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  362. un2telugu()
  363. break;
  364. case "10":
  365. b2s()
  366. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  367. roman_to_myanmar()
  368. break;
  369. case "11":
  370. b2s()
  371. document.getElementById("txtInput").value = document.getElementById("txtOutput").value
  372. roman_to_tai_tham()
  373. break;
  374. }
  375. document.getElementById("txtInput").value = txt0
  376. }
  377. </script>
  378. <style>
  379. .bg0 {
  380. background-color: #FF9;
  381. }
  382. .bg1 {
  383. background-color: #AAA;
  384. }
  385. </style>
  386. </head>
  387. <body class="mainbody" id="mbody"
  388. 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;">
  389. <!-- tool bar begin-->
  390. <div class='toolbar'>
  391. <script language="javascript">
  392. if (!g_is_mobile) {
  393. document.write("<button id=\"B_Navi\" onclick=\"setNaviVisibility()\" type=\"button\">≡</button> ");
  394. }
  395. </script>
  396. <script language="javascript">
  397. </script>
  398. <span id="debug"></span>
  399. </div>
  400. <!--tool bar end -->
  401. <div class="main" style="width:100%;height:100%;text-align:center; ">
  402. <div style="text-align:center; float:left;width:40%;height:80%;">
  403. My Text Is In<select id="input_str" style="align:center; float:down; font-size: 100%;margin:20px;">
  404. <option value="1">Sangayana</option>
  405. <option value="2">Pāli Roman Unicode</option>
  406. <option value="3">Sinhala</option>
  407. <option value="4">Myanmar1</option>
  408. <option value="5">Myanmar2</option>
  409. </select></br>
  410. <textarea id="txtInput" rows="30" cols=""
  411. 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>
  412. </div>
  413. <div style="text-align:center; float:left;width:15%;">
  414. </br></br></br></br></br></br></br></br></br></br></br></br>
  415. ṃ/ṁ/ŋ become
  416. <select id="m_str" style="align:center; font-size: 120%">
  417. <option value="ṃ,Ṃ">ṃ</option>
  418. <option value="ṁ,Ṁ">ṁ</option>
  419. <option value="ŋ,Ŋ">ŋ</option>
  420. </select>
  421. </br>
  422. </br>
  423. <button id="transfer" style="align:center; font-size: 200%; width:70px" type="button"
  424. onclick="run()">→</button>
  425. </div>
  426. <div style="text-align:center; float:left;width:40%;height:80%;">
  427. I Need the Text In<select id="output_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">Sinhala1</option>
  431. <option value="4">Sinhala2</option>
  432. <option value="5">锡兰注音[详]</option>
  433. <option value="6">锡兰注音[简]</option>
  434. <option value="8">汉语拼音[锡]</option>
  435. <option value="9">Telugu</option>
  436. <option value="10">Myanmar</option>
  437. <option value="11">经典傣文</option>
  438. </select></br>
  439. <textarea id="txtOutput" rows="30" cols=""
  440. style="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>
  441. </div>
  442. <div class="debugMsg" id="xmldata">
  443. <!--调试信息-->
  444. </div>
  445. <!--right side end-->
  446. </div>
  447. <div id="modifywin">
  448. </div>
  449. </body>
  450. </html>