tests_utf8.inc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /**--------------------------------------------------------------------------**\
  2. ===================================
  3. y_punycode - Character encodings.
  4. ===================================
  5. Description:
  6. Functions for converting unicode strings to and from punycode, to be
  7. represented in just ASCII characters. Based on several public
  8. implementations and the RFC, adapted for PAWN. For more information see:
  9. https://en.wikipedia.org/wiki/Punycode
  10. Also includes a function that hooks the "HTTP" function to allow for
  11. internationalised domain names with that function.
  12. Legal:
  13. Version: MPL 1.1
  14. The contents of this file are subject to the Mozilla Public License Version
  15. 1.1 (the "License"); you may not use this file except in compliance with
  16. the License. You may obtain a copy of the License at
  17. http://www.mozilla.org/MPL/
  18. Software distributed under the License is distributed on an "AS IS" basis,
  19. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  20. for the specific language governing rights and limitations under the
  21. License.
  22. The Original Code is the YSI punycode include.
  23. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  24. Portions created by the Initial Developer are Copyright (C) 2011
  25. the Initial Developer. All Rights Reserved.
  26. Contributors:
  27. ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
  28. Thanks:
  29. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  30. ZeeX - Very productive conversations.
  31. koolk - IsPlayerinAreaEx code.
  32. TheAlpha - Danish translation.
  33. breadfish - German translation.
  34. Fireburn - Dutch translation.
  35. yom - French translation.
  36. 50p - Polish translation.
  37. Zamaroht - Spanish translation.
  38. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  39. for me to strive to better.
  40. Pixels^ - Running XScripters where the idea was born.
  41. Matite - Pestering me to release it and using it.
  42. Very special thanks to:
  43. Thiadmer - PAWN, whose limits continue to amaze me!
  44. Kye/Kalcor - SA:MP.
  45. SA:MP Team past, present and future - SA:MP.
  46. Version:
  47. 0.1
  48. Changelog:
  49. 29/04/13:
  50. Added Puny_HTTP.
  51. 26/04/13:
  52. First version.
  53. Functions:
  54. Public
  55. -
  56. Core:
  57. -
  58. Stock:
  59. Puny_Encode - Convert a Unicode string to Punycode.
  60. Puny_Decode - Convert a Punycode string to Unicode.
  61. Puny_HTTP - Wrapper for "HTTP" to encode domain names.
  62. Static:
  63. -
  64. Inline:
  65. -
  66. API:
  67. -
  68. Callbacks:
  69. -
  70. Definitions:
  71. -
  72. Enums:
  73. -
  74. Macros:
  75. -
  76. Tags:
  77. -
  78. Variables:
  79. Global:
  80. -
  81. Static:
  82. -
  83. Commands:
  84. -
  85. Compile options:
  86. -
  87. Operators:
  88. -
  89. \**--------------------------------------------------------------------------**/
  90. Test:y_punycode_1()
  91. {
  92. new
  93. dst[32];
  94. Puny_Encode(dst, "bücher");
  95. ASSERT(!strcmp(dst, "bcher-kva"));
  96. Puny_Encode(dst, "büücher");
  97. ASSERT(!strcmp(dst, "bcher-kvaa"));
  98. Puny_Encode(dst, "bücüher");
  99. ASSERT(!strcmp(dst, "bcher-kvab"));
  100. Puny_Encode(dst, "bücherü");
  101. ASSERT(!strcmp(dst, "bcher-kvae"));
  102. Puny_Encode(dst, "ýbücher");
  103. ASSERT(!strcmp(dst, "bcher-kvaf"));
  104. Puny_Encode(dst, "übücher");
  105. ASSERT(!strcmp(dst, "bcher-jvab"));
  106. }
  107. /*
  108. xn--mgbh0fb.xn--kgbechtv http://مثال.إختبار Arabic Arabic
  109. xn--fsqu00a.xn--0zwm56d http://例子.测试 Simplified Chinese Chinese
  110. xn--fsqu00a.xn--g6w251d http://例子.測試 Traditional Chinese Chinese
  111. xn--hxajbheg2az3al.xn--jxalpdlp http://παράδειγμα.δοκιμή Greek Greek
  112. xn--p1b6ci4b4b3a.xn--11b5bs3a9aj6g http://उदाहरण.परीक्षा Devanagari Hindi
  113. xn--r8jz45g.xn--zckzah http://例え.テスト Kanji+Kana Japanese
  114. xn--9n2bp8q.xn--9t4b11yi5a http://실례.테스트 Hangul Korean
  115. xn--mgbh0fb.xn--hgbk6aj7f53bba http://مثال.آزمایشی Perso-Arabic Persian
  116. xn--e1afmkfd.xn--80akhbyknj4f http://пример.испытание Cyrillic Russian
  117. xn--zkc6cc5bi7f6e.xn--hlcj6aya9esc7a http://உதாரணம்.பரிட்சை Tamil Tamil
  118. xn--6dbbec0c.xn--deba0ad http://דוגמה.טעסט Hebrew Hebrew
  119. xn--fdbk5d8ap9b8a8d.xn--deba0ad http://בײַשפּיל.טעסט Hebrew Yiddish
  120. */