Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7285 | leency | 1 | // unicode conversion for special characters |
2 | char *unicode_tags[]={ |
||
3 | "nbsp", " ", |
||
4 | "#38", " ", |
||
5 | "#160", " ", |
||
6 | |||
7 | "ntilde", "n", // spanish n special ñ |
||
8 | "#224", "à", // spanish a with grove accent 'à' |
||
9 | "#241", "n", // spanish symbol |
||
10 | |||
11 | "copy", "(c)", |
||
12 | "#169", "(c)", |
||
13 | |||
14 | "trade", "[TM]", |
||
15 | |||
16 | "reg", "(r)", |
||
17 | "#174", "(r)", |
||
18 | |||
19 | "bdquo", ",,", |
||
20 | |||
21 | "amp", "&", |
||
22 | "#38", "&", |
||
23 | |||
24 | "lt", "<", |
||
25 | "#60", "<", |
||
26 | |||
27 | "gt", ">", |
||
28 | "#62", ">", |
||
29 | |||
30 | "minus", "-", |
||
31 | "ndash", "-", |
||
32 | "mdash", "-", //-- |
||
33 | "#8722", "-", |
||
34 | "#8211", "-", |
||
35 | "#151", "-", |
||
36 | "#149", "-", |
||
37 | |||
38 | "rsquo", "'", |
||
39 | "#39", "'", |
||
40 | "#96", "'", |
||
41 | "#8217", "'", |
||
42 | |||
43 | "quot", "\"", |
||
44 | "#34", "\"", |
||
45 | "ldquo", "\"", |
||
46 | "rdquo", "\"", |
||
47 | "#8222", "\"", |
||
48 | "#8221", "\"", |
||
49 | |||
50 | "laquo", "<<", |
||
51 | "#171", "<<", |
||
52 | "raquo", ">>", |
||
53 | "#187", ">>", |
||
54 | |||
55 | "uarr", "\24", |
||
56 | "darr", "\25", |
||
57 | "rarr", "\26", |
||
58 | "larr", "\27", |
||
59 | |||
60 | "#1028", "\242", |
||
61 | "#1030", "I", |
||
62 | "#1031", "\244", |
||
63 | |||
64 | "#8470", "N", |
||
65 | "bull", "-", //âîîáùå çäåñü òî÷êà |
||
66 | "percnt","%", |
||
67 | |||
68 | 0}; |
||
69 | |||
70 | // function to be called to fix the special symbols |
||
71 | void fixSpecial(dword text) { |
||
72 | byte ch; |
||
73 | int i , j, z; |
||
74 | dword aux; |
||
75 | dword text2 = text; |
||
76 | loop () { |
||
77 | ch = ESBYTE[text]; |
||
78 | if (!ch) return; |
||
79 | if (ch=='&') { |
||
80 | i = 0; |
||
81 | j = 0; |
||
82 | text++; |
||
83 | while ( i < 7) { |
||
84 | ch = ESBYTE[text]; |
||
85 | if (ch == ';') { |
||
86 | z = get_symbol(#str); |
||
87 | if (z == -1) { // not found |
||
88 | ch = ' '; |
||
89 | } |
||
90 | else { // tag found |
||
91 | aux = unicode_tags[z]; |
||
92 | strtrim(aux); |
||
93 | ch = ESBYTE[aux]; |
||
94 | // copy the special symbol found |
||
95 | while (ch) { |
||
96 | ESBYTE[text2] = ch; |
||
97 | aux++; |
||
98 | text2++; |
||
99 | ch = ESBYTE[aux]; |
||
100 | } |
||
101 | ch = ESBYTE[text2]; |
||
102 | } |
||
103 | // clean the old symbol |
||
104 | while (ch != ';') { |
||
105 | ESBYTE[text2] = ' ';// should be (char) 0; |
||
106 | text2++; |
||
107 | ch = ESBYTE[text2]; |
||
108 | } |
||
109 | ESBYTE[text2] = ' '; // should be '' or char 0 |
||
110 | break; |
||
111 | } |
||
112 | str[i] = ch; |
||
113 | if (!ch) return; |
||
114 | text++; |
||
115 | i++; |
||
116 | } |
||
117 | for (i=0; i < 7; i++) str[i] = 0; // clean str |
||
118 | } |
||
119 | text++; |
||
120 | text2++; |
||
121 | } |
||
122 | } |
||
123 | |||
124 | |||
125 | |||
126 | // function to look for the conversion of special characters |
||
127 | // if not found--> return -1 |
||
128 | int get_symbol(char *str2) { |
||
129 | int i,j; |
||
130 | //debugln(#str2); |
||
131 | for (i=0; unicode_tags[i]!=0; i+=2) { |
||
132 | if (strcmp(str2, unicode_tags[i]) == 0) { |
||
133 | return (i+1); |
||
134 | } |
||
135 | } |
||
136 | return -1; |
||
137 | }>>", |
||
138 | |||
139 | |||
140 |