views:

29

answers:

1

Dear All, How I can encode a text file to ASMO449+?

Thanks

A: 

That's code page 709. Difficult, .NET doesn't support it. Best thing to do is to using code page 1256, the Windows code page for Arabic, then translate the bytes using this conversion table:

/*000-015*/ 000 001 249 003 004 005 006 007 008 009 010 011 012 013 014 015
/*016-031*/ 016 017 018 019 022 023 024 025 026 027 028 029 030 031 254 255
/*032-047*/ 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047
/*048-063*/ 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063
/*064-079*/ 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079
/*080-095*/ 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095
/*096-111*/ 096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111
/*112-127*/ 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
/*128-143*/ 128 132 174 159 134 141 142 143 144 145 146 190 148 149 155 156
/*144-159*/ 157 158 160 161 162 002 163 224 164 165 166 188 167 252 168 169
/*160-175*/ 171 172 154 176 177 178 179 021 180 181 182 183 184 173 185 186
/*176-191*/ 189 192 220 221 222 223 020 250 153 243 187 244 245 246 247 191
/*192-207*/ 248 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
/*208-223*/ 208 209 210 211 212 213 214 170 215 216 217 218 219 225 226 227
/*224-239*/ 133 228 131 229 230 231 232 135 138 130 136 137 233 234 140 139
/*240-255*/ 235 236 237 238 147 239 240 175 241 151 242 150 129 251 152 253

        var enc = Encoding.GetEncoding(1256);
        var ara = "العربية";
        var res = enc.GetBytes(ara);
        // TODO: apply table
        //...
Hans Passant
Can you tell me , a code snipt to apply this table convertion, because i don't have enough exprience in using this table?Thanks for reply.
No thanks, too much work. Consider it a great way to get more experience.
Hans Passant
yah, you are right, but can you tell me what i can take benifit from this table, i know that each character represnet a nummber which is explaining in the table, but for example the character 'A' which is in the table 65 what should i do next i mean translate it to what?Thanks
You need to convert bytes, not characters. The bytes in the "res" array. 65 converts to 65 according to the table. 255 converts to 253. Etcetera. You could do it with a big Select statement to keep it simple.
Hans Passant
yes, i got it. On more question, after i finish the converting to the correspoding table convertion for asmo448, in which encoding should i save the text file?
Save it as bytes. FileStream.
Hans Passant
i will start writing the code , and then i will tell you the result.Thanks.