unicode.html 15 KB

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