KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > nu > xom > ISOArabicWriter


1 /* Copyright 2002, 2003 Elliotte Rusty Harold
2    
3    This library is free software; you can redistribute it and/or modify
4    it under the terms of version 2.1 of the GNU Lesser General Public
5    License as published by the Free Software Foundation.
6    
7    This library is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10    GNU Lesser General Public License for more details.
11    
12    You should have received a copy of the GNU Lesser General Public
13    License along with this library; if not, write to the
14    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
15    Boston, MA 02111-1307 USA
16    
17    You can contact Elliotte Rusty Harold by sending e-mail to
18    elharo@metalab.unc.edu. Please include the word "XOM" in the
19    subject line. The XOM home page is located at http://www.xom.nu/
20 */

21
22 package nu.xom;
23
24 import java.io.Writer JavaDoc;
25
26 /**
27  * <p>
28  * ISO 8859-6, ASCII plus Arabic
29  * </p>
30  *
31  * @author Elliotte Rusty Harold
32  * @version 1.0
33  *
34  */

35 class ISOArabicWriter extends TextWriter {
36
37     ISOArabicWriter(Writer JavaDoc out, String JavaDoc encoding) {
38         super(out, encoding);
39     }
40
41     /**
42      * @see nu.xom.TextWriter#needsEscaping(char)
43      */

44     boolean needsEscaping(char c) {
45         if (c <= 0xA0) return false;
46         switch (c) {
47             case 0x060C: return false; // ARABIC COMMA
48
case 0x060D: return true; // place holder to allow table lookup
49
case 0x060E: return true; // place holder to allow table lookup
50
case 0x060F: return true; // place holder to allow table lookup
51
case 0x0610: return true; // place holder to allow table lookup
52
case 0x0611: return true; // place holder to allow table lookup
53
case 0x0612: return true; // place holder to allow table lookup
54
case 0x0613: return true; // place holder to allow table lookup
55
case 0x0614: return true; // place holder to allow table lookup
56
case 0x0615: return true; // place holder to allow table lookup
57
case 0x0616: return true; // place holder to allow table lookup
58
case 0x0617: return true; // place holder to allow table lookup
59
case 0x0618: return true; // place holder to allow table lookup
60
case 0x0619: return true; // place holder to allow table lookup
61
case 0x061A: return true; // place holder to allow table lookup
62
case 0x061B: return false; // ARABIC SEMICOLON
63
case 0x061C: return true; // place holder to allow table lookup
64
case 0x061D: return true; // place holder to allow table lookup
65
case 0x061E: return true; // place holder to allow table lookup
66
case 0x061F: return false; // ARABIC QUESTION MARK
67
case 0x0620: return true; // place holder to allow table lookup
68
case 0x0621: return false; // ARABIC LETTER HAMZA
69
case 0x0622: return false; // ARABIC LETTER ALEF WITH MADDA ABOVE
70
case 0x0623: return false; // ARABIC LETTER ALEF WITH HAMZA ABOVE
71
case 0x0624: return false; // ARABIC LETTER WAW WITH HAMZA ABOVE
72
case 0x0625: return false; // ARABIC LETTER ALEF WITH HAMZA BELOW
73
case 0x0626: return false; // ARABIC LETTER YEH WITH HAMZA ABOVE
74
case 0x0627: return false; // ARABIC LETTER ALEF
75
case 0x0628: return false; // ARABIC LETTER BEH
76
case 0x0629: return false; // ARABIC LETTER TEH MARBUTA
77
case 0x062A: return false; // ARABIC LETTER TEH
78
case 0x062B: return false; // ARABIC LETTER THEH
79
case 0x062C: return false; // ARABIC LETTER JEEM
80
case 0x062D: return false; // ARABIC LETTER HAH
81
case 0x062E: return false; // ARABIC LETTER KHAH
82
case 0x062F: return false; // ARABIC LETTER DAL
83
case 0x0630: return false; // ARABIC LETTER THAL
84
case 0x0631: return false; // ARABIC LETTER REH
85
case 0x0632: return false; // ARABIC LETTER ZAIN
86
case 0x0633: return false; // ARABIC LETTER SEEN
87
case 0x0634: return false; // ARABIC LETTER SHEEN
88
case 0x0635: return false; // ARABIC LETTER SAD
89
case 0x0636: return false; // ARABIC LETTER DAD
90
case 0x0637: return false; // ARABIC LETTER TAH
91
case 0x0638: return false; // ARABIC LETTER ZAH
92
case 0x0639: return false; // ARABIC LETTER AIN
93
case 0x063A: return false; // ARABIC LETTER GHAIN
94
case 0x063B: return true; // place holder to allow table lookup
95
case 0x063C: return true; // place holder to allow table lookup
96
case 0x063D: return true; // place holder to allow table lookup
97
case 0x063E: return true; // place holder to allow table lookup
98
case 0x063F: return true; // place holder to allow table lookup
99
case 0x0640: return false; // ARABIC TATWEEL
100
case 0x0641: return false; // ARABIC LETTER FEH
101
case 0x0642: return false; // ARABIC LETTER QAF
102
case 0x0643: return false; // ARABIC LETTER KAF
103
case 0x0644: return false; // ARABIC LETTER LAM
104
case 0x0645: return false; // ARABIC LETTER MEEM
105
case 0x0646: return false; // ARABIC LETTER NOON
106
case 0x0647: return false; // ARABIC LETTER HEH
107
case 0x0648: return false; // ARABIC LETTER WAW
108
case 0x0649: return false; // ARABIC LETTER ALEF MAKSURA
109
case 0x064A: return false; // ARABIC LETTER YEH
110
case 0x064B: return false; // ARABIC FATHATAN
111
case 0x064C: return false; // ARABIC DAMMATAN
112
case 0x064D: return false; // ARABIC KASRATAN
113
case 0x064E: return false; // ARABIC FATHA
114
case 0x064F: return false; // ARABIC DAMMA
115
case 0x0650: return false; // ARABIC KASRA
116
case 0x0651: return false; // ARABIC SHADDA
117
case 0x0652: return false; // ARABIC SUKUN
118
}
119         switch (c) { // random overlap with Latin-1
120
case 0x00A4: return false; // CURRENCY SIGN
121
case 0x00AD: return false; // SOFT HYPHEN
122
}
123         
124         return true;
125         
126     }
127
128 }
Popular Tags