Browse Source

Importing project.

git-svn-id: svn://svn.code.sf.net/p/junidecode/code/trunk@2 b90d0908-0dae-468f-8fb5-926cfc7ab88d
master
ippatsuman 14 years ago
parent
commit
6be30b4b65
  1. 7
      assembly.manifest
  2. 11
      differences_junidecode_textunidecode
  3. 85
      pom.xml
  4. 77
      src/main/java/net/sf/junidecode/App.java
  5. 631
      src/main/java/net/sf/junidecode/Junidecode.java
  6. 294
      src/main/java/net/sf/junidecode/X00.java
  7. 294
      src/main/java/net/sf/junidecode/X01.java
  8. 293
      src/main/java/net/sf/junidecode/X02.java
  9. 293
      src/main/java/net/sf/junidecode/X03.java
  10. 293
      src/main/java/net/sf/junidecode/X04.java
  11. 293
      src/main/java/net/sf/junidecode/X05.java
  12. 293
      src/main/java/net/sf/junidecode/X06.java
  13. 293
      src/main/java/net/sf/junidecode/X07.java
  14. 293
      src/main/java/net/sf/junidecode/X09.java
  15. 293
      src/main/java/net/sf/junidecode/X0a.java
  16. 293
      src/main/java/net/sf/junidecode/X0b.java
  17. 293
      src/main/java/net/sf/junidecode/X0c.java
  18. 293
      src/main/java/net/sf/junidecode/X0d.java
  19. 293
      src/main/java/net/sf/junidecode/X0e.java
  20. 293
      src/main/java/net/sf/junidecode/X0f.java
  21. 293
      src/main/java/net/sf/junidecode/X10.java
  22. 293
      src/main/java/net/sf/junidecode/X11.java
  23. 294
      src/main/java/net/sf/junidecode/X12.java
  24. 293
      src/main/java/net/sf/junidecode/X13.java
  25. 294
      src/main/java/net/sf/junidecode/X14.java
  26. 294
      src/main/java/net/sf/junidecode/X15.java
  27. 293
      src/main/java/net/sf/junidecode/X16.java
  28. 293
      src/main/java/net/sf/junidecode/X17.java
  29. 293
      src/main/java/net/sf/junidecode/X18.java
  30. 293
      src/main/java/net/sf/junidecode/X1e.java
  31. 293
      src/main/java/net/sf/junidecode/X1f.java
  32. 293
      src/main/java/net/sf/junidecode/X20.java
  33. 293
      src/main/java/net/sf/junidecode/X21.java
  34. 293
      src/main/java/net/sf/junidecode/X22.java
  35. 293
      src/main/java/net/sf/junidecode/X23.java
  36. 293
      src/main/java/net/sf/junidecode/X24.java
  37. 293
      src/main/java/net/sf/junidecode/X25.java
  38. 293
      src/main/java/net/sf/junidecode/X26.java
  39. 293
      src/main/java/net/sf/junidecode/X27.java
  40. 294
      src/main/java/net/sf/junidecode/X28.java
  41. 293
      src/main/java/net/sf/junidecode/X2e.java
  42. 293
      src/main/java/net/sf/junidecode/X2f.java
  43. 293
      src/main/java/net/sf/junidecode/X30.java
  44. 293
      src/main/java/net/sf/junidecode/X31.java
  45. 293
      src/main/java/net/sf/junidecode/X32.java
  46. 293
      src/main/java/net/sf/junidecode/X33.java
  47. 293
      src/main/java/net/sf/junidecode/X4d.java
  48. 294
      src/main/java/net/sf/junidecode/X4e.java
  49. 294
      src/main/java/net/sf/junidecode/X4f.java
  50. 294
      src/main/java/net/sf/junidecode/X50.java
  51. 294
      src/main/java/net/sf/junidecode/X51.java
  52. 294
      src/main/java/net/sf/junidecode/X52.java
  53. 294
      src/main/java/net/sf/junidecode/X53.java
  54. 294
      src/main/java/net/sf/junidecode/X54.java
  55. 294
      src/main/java/net/sf/junidecode/X55.java
  56. 294
      src/main/java/net/sf/junidecode/X56.java
  57. 294
      src/main/java/net/sf/junidecode/X57.java
  58. 294
      src/main/java/net/sf/junidecode/X58.java
  59. 294
      src/main/java/net/sf/junidecode/X59.java
  60. 294
      src/main/java/net/sf/junidecode/X5a.java
  61. 294
      src/main/java/net/sf/junidecode/X5b.java
  62. 294
      src/main/java/net/sf/junidecode/X5c.java
  63. 294
      src/main/java/net/sf/junidecode/X5d.java
  64. 294
      src/main/java/net/sf/junidecode/X5e.java
  65. 294
      src/main/java/net/sf/junidecode/X5f.java
  66. 294
      src/main/java/net/sf/junidecode/X60.java
  67. 294
      src/main/java/net/sf/junidecode/X61.java
  68. 294
      src/main/java/net/sf/junidecode/X62.java
  69. 294
      src/main/java/net/sf/junidecode/X63.java
  70. 294
      src/main/java/net/sf/junidecode/X64.java
  71. 294
      src/main/java/net/sf/junidecode/X65.java
  72. 294
      src/main/java/net/sf/junidecode/X66.java
  73. 294
      src/main/java/net/sf/junidecode/X67.java
  74. 294
      src/main/java/net/sf/junidecode/X68.java
  75. 294
      src/main/java/net/sf/junidecode/X69.java
  76. 294
      src/main/java/net/sf/junidecode/X6a.java
  77. 294
      src/main/java/net/sf/junidecode/X6b.java
  78. 294
      src/main/java/net/sf/junidecode/X6c.java
  79. 294
      src/main/java/net/sf/junidecode/X6d.java
  80. 294
      src/main/java/net/sf/junidecode/X6e.java
  81. 294
      src/main/java/net/sf/junidecode/X6f.java
  82. 294
      src/main/java/net/sf/junidecode/X70.java
  83. 294
      src/main/java/net/sf/junidecode/X71.java
  84. 294
      src/main/java/net/sf/junidecode/X72.java
  85. 294
      src/main/java/net/sf/junidecode/X73.java
  86. 294
      src/main/java/net/sf/junidecode/X74.java
  87. 294
      src/main/java/net/sf/junidecode/X75.java
  88. 294
      src/main/java/net/sf/junidecode/X76.java
  89. 294
      src/main/java/net/sf/junidecode/X77.java
  90. 294
      src/main/java/net/sf/junidecode/X78.java
  91. 294
      src/main/java/net/sf/junidecode/X79.java
  92. 294
      src/main/java/net/sf/junidecode/X7a.java
  93. 294
      src/main/java/net/sf/junidecode/X7b.java
  94. 294
      src/main/java/net/sf/junidecode/X7c.java
  95. 294
      src/main/java/net/sf/junidecode/X7d.java
  96. 294
      src/main/java/net/sf/junidecode/X7e.java
  97. 294
      src/main/java/net/sf/junidecode/X7f.java
  98. 294
      src/main/java/net/sf/junidecode/X80.java
  99. 294
      src/main/java/net/sf/junidecode/X81.java
  100. 294
      src/main/java/net/sf/junidecode/X82.java
  101. Some files were not shown because too many files have changed in this diff Show More

7
assembly.manifest

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
License: BSD License
Description: JUnicode
Implementation-URL: http://junidecode.sf.net
Implementation-Version: #version#
Built-By: #user.name#
Build-Date: #today#
Main-Class: #mainclass#

11
differences_junidecode_textunidecode

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
Character Code Point JUnidecode Text::Unidecode
ล‹ U+014A ng NG
ลŠ U+014B NG ng
โ‚ฌ U+20AC EUR EU
โ‚ฐ U+20B0 Pf
โ‚ฑ U+20B1 P
โ‚ฒ U+20B2 G
โ‚ณ U+20B3 A
โ‚ด U+20B4 gh
โ‚ต U+20B5 C/
All the caracters with code point U+20xx

85
pom.xml

@ -0,0 +1,85 @@ @@ -0,0 +1,85 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sf</groupId>
<artifactId>junidecode</artifactId>
<packaging>jar</packaging>
<version>0.1</version>
<name>junidecode</name>
<url>http://junidecode.sf.net</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.directory}/assembly.manifest</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>project</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>process-classes-fix-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="${basedir}/assembly.manifest" todir="${project.build.directory}" overwrite="true"/>
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd hh:mm:ss" />
</tstamp>
<echo>pom.xml: timestamp ${TODAY}</echo>
<replace dir="${project.build.directory}">
<include name="assembly.manifest"/>
<replacefilter token="#build#" value="${buildLabel}"/>
<replacefilter token="#version#" value="${version}"/>
<replacefilter token="#user.name#" value="${user.name}"/>
<replacefilter token="#today#" value="${TODAY}"/>
<replacefilter token="#mainclass#" value="net.sf.junidecode.App"/>
</replace>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

77
src/main/java/net/sf/junidecode/App.java

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
/*
* Copyright (c) 2009, Giuseppe Cardone
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the author nor the names of the contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY GIUSEPPE CARDONE ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GIUSEPPE CARDONE BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.sf.junidecode;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static net.sf.junidecode.Junidecode.*;
/**
* Simple example application for JUnidecode. If launched with arguments
* will strip diacritics and transliterate the arguments. If launched without
* arguments will read lines from stdin, convert input to ASCII 7-bit and
* write to stdout. For example:
* <em>&#917;&#955;&#955;&#951;&#957;&#953;&#954;&#940;</em> becomes
* <em>Ellenika</em>.
* @author Giuseppe Cardone
* @version 0.1
*/
public class App {
/**
* Private constructor to avoid instatiation.
*/
private App() {
}
/**
* Main.
* @param args Strings to transliterate. If <code>args.length == 0</code>
* then the input will be read from stdin.
*/
public static void main(String[] args) {
if (args.length > 0) {
StringBuilder sb = new StringBuilder();
for (String s : args) {
sb.append(unidecode(s)).append(" ");
}
System.out.println(sb.toString().trim());
} else {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
while ((line = br.readLine()) != null) {
System.out.println(unidecode(line));
}
} catch (IOException ex) {
System.err.println(ex.getLocalizedMessage());
}
}
}
}

631
src/main/java/net/sf/junidecode/Junidecode.java

@ -0,0 +1,631 @@ @@ -0,0 +1,631 @@
/*
* Copyright (c) 2009, Giuseppe Cardone
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the author nor the names of the contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY GIUSEPPE CARDONE ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GIUSEPPE CARDONE BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.sf.junidecode;
/**
* Root class of JUnidecode.
* @author Giuseppe Cardone
* @version 0.1
*/
public class Junidecode {
/**
* Array to cache already loaded maps.
*/
private static final String[][] cache = new String[256][];
/**
* Private constructor to avoid instantiation.
*/
private Junidecode() {
}
/**
* Strip diacritic marks and transliterates a unicode string to a valid
* 7-bit ASCII String.
* @since 0.1
* @param s Unicode String to transliterate.
* @return 7-bit ASCII valid string.
*/
public static String unidecode(final String s) {
StringBuilder sb = new StringBuilder();
String[] map;
for (int i = 0; i < s.length(); i++) {
int codepoint = s.codePointAt(i);
int hi = (codepoint >> 8) & 0xff;
int low = codepoint & 0xff;
/*
* Try to load the code mapping from cache. We could of course keep
* a big String[256][256] in memory - which would be a little bit
* faster, but using this array we can keep the memory footprint
* smaller since the class loader loads the needed classes lazily.
* When transliterating from cyrillic we'll never load hiragana
* or greek mappings.
*/
map = cache[hi];
if (null == map) {
switch (hi) {
case 0x00:
map = X00.map;
break;
case 0x01:
map = X01.map;
break;
case 0x02:
map = X02.map;
break;
case 0x03:
map = X03.map;
break;
case 0x04:
map = X04.map;
break;
case 0x05:
map = X05.map;
break;
case 0x06:
map = X06.map;
break;
case 0x07:
map = X07.map;
break;
case 0x09:
map = X09.map;
break;
case 0x0a:
map = X0a.map;
break;
case 0x0b:
map = X0b.map;
break;
case 0x0c:
map = X0c.map;
break;
case 0x0d:
map = X0d.map;
break;
case 0x0e:
map = X0e.map;
break;
case 0x0f:
map = X0f.map;
break;
case 0x10:
map = X10.map;
break;
case 0x11:
map = X11.map;
break;
case 0x12:
map = X12.map;
break;
case 0x13:
map = X13.map;
break;
case 0x14:
map = X14.map;
break;
case 0x15:
map = X15.map;
break;
case 0x16:
map = X16.map;
break;
case 0x17:
map = X17.map;
break;
case 0x18:
map = X18.map;
break;
case 0x1e:
map = X1e.map;
break;
case 0x1f:
map = X1f.map;
break;
case 0x20:
map = X20.map;
break;
case 0x21:
map = X21.map;
break;
case 0x22:
map = X22.map;
break;
case 0x23:
map = X23.map;
break;
case 0x24:
map = X24.map;
break;
case 0x25:
map = X25.map;
break;
case 0x26:
map = X26.map;
break;
case 0x27:
map = X27.map;
break;
case 0x28:
map = X28.map;
break;
case 0x2e:
map = X2e.map;
break;
case 0x2f:
map = X2f.map;
break;
case 0x30:
map = X30.map;
break;
case 0x31:
map = X31.map;
break;
case 0x32:
map = X32.map;
break;
case 0x33:
map = X33.map;
break;
case 0x4d:
map = X4d.map;
break;
case 0x4e:
map = X4e.map;
break;
case 0x4f:
map = X4f.map;
break;
case 0x50:
map = X50.map;
break;
case 0x51:
map = X51.map;
break;
case 0x52:
map = X52.map;
break;
case 0x53:
map = X53.map;
break;
case 0x54:
map = X54.map;
break;
case 0x55:
map = X55.map;
break;
case 0x56:
map = X56.map;
break;
case 0x57:
map = X57.map;
break;
case 0x58:
map = X58.map;
break;
case 0x59:
map = X59.map;
break;
case 0x5a:
map = X5a.map;
break;
case 0x5b:
map = X5b.map;
break;
case 0x5c:
map = X5c.map;
break;
case 0x5d:
map = X5d.map;
break;
case 0x5e:
map = X5e.map;
break;
case 0x5f:
map = X5f.map;
break;
case 0x60:
map = X60.map;
break;
case 0x61:
map = X61.map;
break;
case 0x62:
map = X62.map;
break;
case 0x63:
map = X63.map;
break;
case 0x64:
map = X64.map;
break;
case 0x65:
map = X65.map;
break;
case 0x66:
map = X66.map;
break;
case 0x67:
map = X67.map;
break;
case 0x68:
map = X68.map;
break;
case 0x69:
map = X69.map;
break;
case 0x6a:
map = X6a.map;
break;
case 0x6b:
map = X6b.map;
break;
case 0x6c:
map = X6c.map;
break;
case 0x6d:
map = X6d.map;
break;
case 0x6e:
map = X6e.map;
break;
case 0x6f:
map = X6f.map;
break;
case 0x70:
map = X70.map;
break;
case 0x71:
map = X71.map;
break;
case 0x72:
map = X72.map;
break;
case 0x73:
map = X73.map;
break;
case 0x74:
map = X74.map;
break;
case 0x75:
map = X75.map;
break;
case 0x76:
map = X76.map;
break;
case 0x77:
map = X77.map;
break;
case 0x78:
map = X78.map;
break;
case 0x79:
map = X79.map;
break;
case 0x7a:
map = X7a.map;
break;
case 0x7b:
map = X7b.map;
break;
case 0x7c:
map = X7c.map;
break;
case 0x7d:
map = X7d.map;
break;
case 0x7e:
map = X7e.map;
break;
case 0x7f:
map = X7f.map;
break;
case 0x80:
map = X80.map;
break;
case 0x81:
map = X81.map;
break;
case 0x82:
map = X82.map;
break;
case 0x83:
map = X83.map;
break;
case 0x84:
map = X84.map;
break;
case 0x85:
map = X85.map;
break;
case 0x86:
map = X86.map;
break;
case 0x87:
map = X87.map;
break;
case 0x88:
map = X88.map;
break;
case 0x89:
map = X89.map;
break;
case 0x8a:
map = X8a.map;
break;
case 0x8b:
map = X8b.map;
break;
case 0x8c:
map = X8c.map;
break;
case 0x8d:
map = X8d.map;
break;
case 0x8e:
map = X8e.map;
break;
case 0x8f:
map = X8f.map;
break;
case 0x90:
map = X90.map;
break;
case 0x91:
map = X91.map;
break;
case 0x92:
map = X92.map;
break;
case 0x93:
map = X93.map;
break;
case 0x94:
map = X94.map;
break;
case 0x95:
map = X95.map;
break;
case 0x96:
map = X96.map;
break;
case 0x97:
map = X97.map;
break;
case 0x98:
map = X98.map;
break;
case 0x99:
map = X99.map;
break;
case 0x9a:
map = X9a.map;
break;
case 0x9b:
map = X9b.map;
break;
case 0x9c:
map = X9c.map;
break;
case 0x9d:
map = X9d.map;
break;
case 0x9e:
map = X9e.map;
break;
case 0x9f:
map = X9f.map;
break;
case 0xa0:
map = Xa0.map;
break;
case 0xa1:
map = Xa1.map;
break;
case 0xa2:
map = Xa2.map;
break;
case 0xa3:
map = Xa3.map;
break;
case 0xa4:
map = Xa4.map;
break;
case 0xac:
map = Xac.map;
break;
case 0xad:
map = Xad.map;
break;
case 0xae:
map = Xae.map;
break;
case 0xaf:
map = Xaf.map;
break;
case 0xb0:
map = Xb0.map;
break;
case 0xb1:
map = Xb1.map;
break;
case 0xb2:
map = Xb2.map;
break;
case 0xb3:
map = Xb3.map;
break;
case 0xb4:
map = Xb4.map;
break;
case 0xb5:
map = Xb5.map;
break;
case 0xb6:
map = Xb6.map;
break;
case 0xb7:
map = Xb7.map;
break;
case 0xb8:
map = Xb8.map;
break;
case 0xb9:
map = Xb9.map;
break;
case 0xba:
map = Xba.map;
break;
case 0xbb:
map = Xbb.map;
break;
case 0xbc:
map = Xbc.map;
break;
case 0xbd:
map = Xbd.map;
break;
case 0xbe:
map = Xbe.map;
break;
case 0xbf:
map = Xbf.map;
break;
case 0xc0:
map = Xc0.map;
break;
case 0xc1:
map = Xc1.map;
break;
case 0xc2:
map = Xc2.map;
break;
case 0xc3:
map = Xc3.map;
break;
case 0xc4:
map = Xc4.map;
break;
case 0xc5:
map = Xc5.map;
break;
case 0xc6:
map = Xc6.map;
break;
case 0xc7:
map = Xc7.map;
break;
case 0xc8:
map = Xc8.map;
break;
case 0xc9:
map = Xc9.map;
break;
case 0xca:
map = Xca.map;
break;
case 0xcb:
map = Xcb.map;
break;
case 0xcc:
map = Xcc.map;
break;
case 0xcd:
map = Xcd.map;
break;
case 0xce:
map = Xce.map;
break;
case 0xcf:
map = Xcf.map;
break;
case 0xd0:
map = Xd0.map;
break;
case 0xd1:
map = Xd1.map;
break;
case 0xd2:
map = Xd2.map;
break;
case 0xd3:
map = Xd3.map;
break;
case 0xd4:
map = Xd4.map;
break;
case 0xd5:
map = Xd5.map;
break;
case 0xd6:
map = Xd6.map;
break;
case 0xd7:
map = Xd7.map;
break;
case 0xf9:
map = Xf9.map;
break;
case 0xfa:
map = Xfa.map;
break;
case 0xfb:
map = Xfb.map;
break;
case 0xfc:
map = Xfc.map;
break;
case 0xfd:
map = Xfd.map;
break;
case 0xfe:
map = Xfe.map;
break;
case 0xff:
map = Xff.map;
break;
default:
continue;
}
/*
* Cache the new map using the high byte of the code point
* as index.
*/
cache[hi] = map;
}
/*
* Some code maps contain only 254 elements because the last
* one is reserved.
*/
if (low < map.length) {
sb.append(map[low]);
}
}
return sb.toString();
}
}

294
src/main/java/net/sf/junidecode/X00.java

@ -0,0 +1,294 @@ @@ -0,0 +1,294 @@
/*
* Copyright (c) 2009, Giuseppe Cardone
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the author nor the names of the contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY GIUSEPPE CARDONE ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GIUSEPPE CARDONE BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.sf.junidecode;
/**
* Character map for Unicode characters with codepoint U+00xx.
* @author Giuseppe Cardone
* @version 0.1
*/
class X00 {
public static final String[] map = new String[]{
new String("" + (char) 0x00), // 0x00
new String("" + (char) 0x01), // 0x01
new String("" + (char) 0x02), // 0x02
new String("" + (char) 0x03), // 0x03
new String("" + (char) 0x04), // 0x04
new String("" + (char) 0x05), // 0x05
new String("" + (char) 0x06), // 0x06
new String("" + (char) 0x07), // 0x07
new String("" + (char) 0x08), // 0x08
new String("" + (char) 0x09), // 0x09
new String("" + (char) 0x0a), // 0x0a
new String("" + (char) 0x0b), // 0x0b
new String("" + (char) 0x0c), // 0x0c
new String("" + (char) 0x0d), // 0x0d
new String("" + (char) 0x0e), // 0x0e
new String("" + (char) 0x0f), // 0x0f
new String("" + (char) 0x10), // 0x10
new String("" + (char) 0x11), // 0x11
new String("" + (char) 0x12), // 0x12
new String("" + (char) 0x13), // 0x13
new String("" + (char) 0x14), // 0x14
new String("" + (char) 0x15), // 0x15
new String("" + (char) 0x16), // 0x16
new String("" + (char) 0x17), // 0x17
new String("" + (char) 0x18), // 0x18
new String("" + (char) 0x19), // 0x19
new String("" + (char) 0x1a), // 0x1a
new String("" + (char) 0x1b), // 0x1b
new String("" + (char) 0x1c), // 0x1c
new String("" + (char) 0x1d), // 0x1d
new String("" + (char) 0x1e), // 0x1e
new String("" + (char) 0x1f), // 0x1f
" ", // 0x20
"!", // 0x21
"\"", // 0x22
"#", // 0x23
"$", // 0x24
"%", // 0x25
"&", // 0x26
"\'", // 0x27
"(", // 0x28
")", // 0x29
"*", // 0x2a
"+", // 0x2b
",", // 0x2c
"-", // 0x2d
".", // 0x2e
"/", // 0x2f
"0", // 0x30
"1", // 0x31
"2", // 0x32
"3", // 0x33
"4", // 0x34
"5", // 0x35
"6", // 0x36
"7", // 0x37
"8", // 0x38
"9", // 0x39
":", // 0x3a
";", // 0x3b
"<", // 0x3c
"=", // 0x3d
">", // 0x3e
"?", // 0x3f
"@", // 0x40
"A", // 0x41
"B", // 0x42
"C", // 0x43
"D", // 0x44
"E", // 0x45
"F", // 0x46
"G", // 0x47
"H", // 0x48
"I", // 0x49
"J", // 0x4a
"K", // 0x4b
"L", // 0x4c
"M", // 0x4d
"N", // 0x4e
"O", // 0x4f
"P", // 0x50
"Q", // 0x51
"R", // 0x52
"S", // 0x53
"T", // 0x54
"U", // 0x55
"V", // 0x56
"W", // 0x57
"X", // 0x58
"Y", // 0x59
"Z", // 0x5a
"]", // 0x5b
"\\", // 0x5c
"]", // 0x5d
"^", // 0x5e
"_", // 0x5f
"`", // 0x60
"a", // 0x61
"b", // 0x62
"c", // 0x63
"d", // 0x64
"e", // 0x65
"f", // 0x66
"g", // 0x67
"h", // 0x68
"i", // 0x69
"j", // 0x6a
"k", // 0x6b
"l", // 0x6c
"m", // 0x6d
"n", // 0x6e
"o", // 0x6f
"p", // 0x70
"q", // 0x71
"r", // 0x72
"s", // 0x73
"t", // 0x74
"u", // 0x75
"v", // 0x76
"w", // 0x77
"x", // 0x78
"y", // 0x79
"z", // 0x7a
"{", // 0x7b
"|", // 0x7c
"}", // 0x7d
"~", // 0x7e
"", // 0x7f
"", // 0x80
"", // 0x81
"", // 0x82
"", // 0x83
"", // 0x84
"", // 0x85
"", // 0x86
"", // 0x87
"", // 0x88
"", // 0x89
"", // 0x8a
"", // 0x8b
"", // 0x8c
"", // 0x8d
"", // 0x8e
"", // 0x8f
"", // 0x90
"", // 0x91
"", // 0x92
"", // 0x93
"", // 0x94
"", // 0x95
"", // 0x96
"", // 0x97
"", // 0x98
"", // 0x99
"", // 0x9a
"", // 0x9b
"", // 0x9c
"", // 0x9d
"", // 0x9e
"", // 0x9f
" ", // 0xa0
"!", // 0xa1
"C/", // 0xa2
"PS", // 0xa3
"$?", // 0xa4
"Y=", // 0xa5
"|", // 0xa6
"SS", // 0xa7
"\"", // 0xa8
"(c)", // 0xa9
"a", // 0xaa
"<<", // 0xab
"!", // 0xac
"", // 0xad
"(r)", // 0xae
"-", // 0xaf
"deg", // 0xb0
"+-", // 0xb1
"2", // 0xb2
"3", // 0xb3
"\'", // 0xb4
"u", // 0xb5
"P", // 0xb6
"*", // 0xb7
",", // 0xb8
"1", // 0xb9
"o", // 0xba
">>", // 0xbb
"1/4", // 0xbc
"1/2", // 0xbd
"3/4", // 0xbe
"?", // 0xbf
"A", // 0xc0
"A", // 0xc1
"A", // 0xc2
"A", // 0xc3
"A", // 0xc4
"A", // 0xc5
"AE", // 0xc6
"C", // 0xc7
"E", // 0xc8
"E", // 0xc9
"E", // 0xca
"E", // 0xcb
"I", // 0xcc
"I", // 0xcd
"I", // 0xce
"I", // 0xcf
"D", // 0xd0
"N", // 0xd1
"O", // 0xd2
"O", // 0xd3
"O", // 0xd4
"O", // 0xd5
"O", // 0xd6
"x", // 0xd7
"O", // 0xd8
"U", // 0xd9
"U", // 0xda
"U", // 0xdb
"U", // 0xdc
"U", // 0xdd
"Th", // 0xde
"ss", // 0xdf
"a", // 0xe0
"a", // 0xe1
"a", // 0xe2
"a", // 0xe3
"a", // 0xe4
"a", // 0xe5
"ae", // 0xe6
"c", // 0xe7
"e", // 0xe8
"e", // 0xe9
"e", // 0xea
"e", // 0xeb
"i", // 0xec
"i", // 0xed
"i", // 0xee
"i", // 0xef
"d", // 0xf0
"n", // 0xf1
"o", // 0xf2
"o", // 0xf3
"o", // 0xf4
"o", // 0xf5
"o", // 0xf6
"/", // 0xf7
"o", // 0xf8
"u", // 0xf9
"u", // 0xfa
"u", // 0xfb
"u", // 0xfc
"y", // 0xfd
"th", // 0xfe
"y" // 0xff
};
}

294
src/main/java/net/sf/junidecode/X01.java

@ -0,0 +1,294 @@ @@ -0,0 +1,294 @@
/*
* Copyright (c) 2009, Giuseppe Cardone
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the author nor the names of the contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY GIUSEPPE CARDONE ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GIUSEPPE CARDONE BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.sf.junidecode;
/**
* Character map for Unicode characters with codepoint U+01xx.
* @author Giuseppe Cardone
* @version 0.1
*/
class X01 {
public static final String[] map = new String[]{
"A", // 0x00
"a", // 0x01
"A", // 0x02
"a", // 0x03
"A", // 0x04
"a", // 0x05
"C", // 0x06
"c", // 0x07
"C", // 0x08
"c", // 0x09
"C", // 0x0a
"c", // 0x0b
"C", // 0x0c
"c", // 0x0d
"D", // 0x0e
"d", // 0x0f
"D", // 0x10
"d", // 0x11
"E", // 0x12
"e", // 0x13
"E", // 0x14
"e", // 0x15
"E", // 0x16
"e", // 0x17
"E", // 0x18
"e", // 0x19
"E", // 0x1a
"e", // 0x1b
"G", // 0x1c
"g", // 0x1d
"G", // 0x1e
"g", // 0x1f
"G", // 0x20
"g", // 0x21
"G", // 0x22
"g", // 0x23
"H", // 0x24
"h", // 0x25
"H", // 0x26
"h", // 0x27
"I", // 0x28
"i", // 0x29
"I", // 0x2a
"i", // 0x2b
"I", // 0x2c
"i", // 0x2d
"I", // 0x2e
"i", // 0x2f
"I", // 0x30
"i", // 0x31
"IJ", // 0x32
"", // 0x33
"J", // 0x34
"j", // 0x35
"K", // 0x36
"k", // 0x37
"k", // 0x38
"L", // 0x39
"l", // 0x3a
"L", // 0x3b
"l", // 0x3c
"L", // 0x3d
"l", // 0x3e
"L", // 0x3f
"l", // 0x40
"L", // 0x41
"l", // 0x42
"N", // 0x43
"n", // 0x44
"N", // 0x45
"n", // 0x46
"N", // 0x47
"n", // 0x48
"\'n", // 0x49
"NG", // 0x4a
"ng", // 0x4b
"O", // 0x4c
"o", // 0x4d
"O", // 0x4e
"o", // 0x4f
"O", // 0x50
"o", // 0x51
"OE", // 0x52
"oe", // 0x53
"R", // 0x54
"r", // 0x55
"R", // 0x56
"r", // 0x57
"R", // 0x58
"r", // 0x59
"S", // 0x5a
"s", // 0x5b
"S", // 0x5c
"s", // 0x5d
"S", // 0x5e
"s", // 0x5f
"S", // 0x60
"s", // 0x61
"T", // 0x62
"t", // 0x63
"T", // 0x64
"t", // 0x65
"T", // 0x66
"t", // 0x67
"U", // 0x68
"u", // 0x69
"U", // 0x6a
"u", // 0x6b
"U", // 0x6c
"u", // 0x6d
"U", // 0x6e
"u", // 0x6f
"U", // 0x70
"u", // 0x71
"U", // 0x72
"u", // 0x73
"W", // 0x74
"w", // 0x75
"Y", // 0x76
"y", // 0x77
"Y", // 0x78
"Z", // 0x79
"z", // 0x7a
"Z", // 0x7b
"z", // 0x7c
"Z", // 0x7d
"z", // 0x7e
"s", // 0x7f
"b", // 0x80
"B", // 0x81
"B", // 0x82
"b", // 0x83
"6", // 0x84
"6", // 0x85
"O", // 0x86
"C", // 0x87
"c", // 0x88
"D", // 0x89
"D", // 0x8a
"D", // 0x8b
"d", // 0x8c
"d", // 0x8d
"3", // 0x8e
"@", // 0x8f
"E", // 0x90
"F", // 0x91
"f", // 0x92
"G", // 0x93
"G", // 0x94
"hv", // 0x95
"I", // 0x96
"I", // 0x97
"K", // 0x98
"k", // 0x99
"l", // 0x9a
"l", // 0x9b
"W", // 0x9c
"N", // 0x9d
"n", // 0x9e
"O", // 0x9f
"O", // 0xa0
"o", // 0xa1
"OI", // 0xa2
"oi", // 0xa3
"P", // 0xa4
"p", // 0xa5
"YR", // 0xa6
"2", // 0xa7
"2", // 0xa8
"SH", // 0xa9
"sh", // 0xaa
"t", // 0xab
"T", // 0xac
"t", // 0xad
"T", // 0xae
"U", // 0xaf
"u", // 0xb0
"Y", // 0xb1
"V", // 0xb2
"Y", // 0xb3
"y", // 0xb4
"Z", // 0xb5
"z", // 0xb6
"ZH", // 0xb7
"ZH", // 0xb8
"zh", // 0xb9
"zh", // 0xba
"2", // 0xbb
"5", // 0xbc
"5", // 0xbd
"ts", // 0xbe
"w", // 0xbf
"|", // 0xc0
"||", // 0xc1
"|=", // 0xc2
"!", // 0xc3
"DZ", // 0xc4
"Dz", // 0xc5
"dz", // 0xc6
"LJ", // 0xc7
"Lj", // 0xc8
"lj", // 0xc9
"NJ", // 0xca
"Nj", // 0xcb
"nj", // 0xcc
"A", // 0xcd
"a", // 0xce
"I", // 0xcf
"i", // 0xd0
"O", // 0xd1
"o", // 0xd2
"U", // 0xd3
"u", // 0xd4
"U", // 0xd5
"u", // 0xd6
"U", // 0xd7
"u", // 0xd8
"U", // 0xd9
"u", // 0xda
"U", // 0xdb
"u", // 0xdc
"@", // 0xdd
"A", // 0xde
"a", // 0xdf
"A", // 0xe0
"a", // 0xe1
"AE", // 0xe2
"ae", // 0xe3
"G", // 0xe4
"g", // 0xe5
"G", // 0xe6
"g", // 0xe7
"K", // 0xe8