package provide stead 2.0

# fichier accents_Iso8859_Hexa_To_Iso8859_8bits.tcl
# maj :
#   04/12/2007 (diam) tranformation en filtre
#   25/03/1996 (commeau) 
#   25/11/1996 (diam) Quelques caracteres de plus dont le set iso8859(=3D) =


# procédure permettant de transformer les caracteres ISO 8859-1 
# codés en hexa en caracteres 8bits ISO
# Objectif : rendre lisible certains mail ou les accents apparaissent sous 
# la forme "=E9"  au lieu de "é" (e accent aigù)


proc accents_Iso8859_Hexa_To_Iso8859_8bits {text} {
   
   # On crée un tableau de correspondance Code ISO8859-1 <--> ISO
   # du style : set iso8859(=E9) "é" :
   
   # la commande "array set ..." n'est possible qu'a partir de tcl7.0 !
   # array set iso8859 {
   #   é eacute
   #   è egrave
   #   ...
   #   Ç Ccedilla     
   # 
   # }      

   set iso8859(=\n) ""
   set iso8859(=20) ""

   set iso8859(=3D) =

   set iso8859(=E9) é
   set iso8859(=E8) è
   set iso8859(=EA) ê
   set iso8859(=EB) ë
   
   set iso8859(=E0) à
   set iso8859(=E2) â
   set iso8859(=EE) î
   set iso8859(=EF) ï
   
   set iso8859(=F9) ù
   set iso8859(=FB) û
   set iso8859(=F4) ô
   set iso8859(=E7) ç
   
   set iso8859(=C9) É
   set iso8859(=C8) È
   set iso8859(=CA) Ê
   set iso8859(=CB) Ë
   
   set iso8859(=C0) À
   set iso8859(=C2) Â
   set iso8859(=CE) Î
   set iso8859(=CF) Ï
   
   set iso8859(=D9) Ù
   set iso8859(=DB) Û
   set iso8859(=D4) Ô
   set iso8859(=C7) Ç

   set iso8859(=B0) °

   foreach char [array names iso8859] {
       regsub -all -- $char $text "$iso8859($char)" text
       regsub -all -- [string tolower $char] $text "$iso8859($char)" text
   }
      
   return $text

}
return
########################################################################
# Documentation complément :


A1- Table ISO-8859-1

Les 128 premiers caracteres sont identiques a l'US-ASCII, et ne sont pas
repetes ici.  Les caracteres 128 a 159 repetent les caracteres de
controle de 0 a 31 de l'US-ASCII, et sont donc sans interet.

+----+-----+---+------------------------------------------------------
|Hex | Dec |Car| Description ISO/IEC 10646-1:1993(E)
+----+-----+---+------------------------------------------------------
|    |     |   |
| A0 | 160 |   | NO-BREAK SPACE
| A1 | 161 | ¡ | INVERTED EXCLAMATION MARK
| A2 | 162 | ¢ | CENT SIGN
| A3 | 163 | £ | POUND SIGN
| A4 | 164 | ¤ | CURRENCY SIGN
| A5 | 165 | ¥ | YEN SIGN
| A6 | 166 | ¦ | BROKEN BAR
| A7 | 167 | § | SECTION SIGN
| A8 | 168 | ¨ | DIAERESIS
| A9 | 169 | © | COPYRIGHT SIGN
| AA | 170 | ª | FEMININE ORDINAL INDICATOR
| AB | 171 | « | LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
| AC | 172 | ¬ | NOT SIGN
| AD | 173 | ­ | SOFT HYPHEN
| AE | 174 | ® | REGISTERED SIGN
| AF | 175 | ¯ | MACRON
|    |     |   |
| B0 | 176 | ° | DEGREE SIGN
| B1 | 177 | ± | PLUS-MINUS SIGN
| B2 | 178 | ² | SUPERSCRIPT TWO
| B3 | 179 | ³ | SUPERSCRIPT THREE
| B4 | 180 | ´ | ACUTE ACCENT
| B5 | 181 | µ | MICRO SIGN
| B6 | 182 | ¶ | PILCROW SIGN
| B7 | 183 | · | MIDDLE DOT
| B8 | 184 | ¸ | CEDILLA
| B9 | 185 | ¹ | SUPERSCRIPT ONE
| BA | 186 | º | MASCULINE ORDINAL INDICATOR
| BB | 187 | » | RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
| BC | 188 | ¼ | VULGAR FRACTION ONE QUARTER
| BD | 189 | ½ | VULGAR FRACTION ONE HALF
| BE | 190 | ¾ | VULGAR FRACTION THREE QUARTERS
| BF | 191 | ¿ | INVERTED QUESTION MARK
|    |     |   |
| C0 | 192 | À | LATIN CAPITAL LETTER A WITH GRAVE ACCENT
| C1 | 193 | Á | LATIN CAPITAL LETTER A WITH ACUTE ACCENT
| C2 | 194 | Â | LATIN CAPITAL LETTER A WITH CIRCUMFLEX ACCENT
| C3 | 195 | Ã | LATIN CAPITAL LETTER A WITH TILDE
| C4 | 196 | Ä | LATIN CAPITAL LETTER A WITH DIAERESIS
| C5 | 197 | Å | LATIN CAPITAL LETTER A WITH RING ABOVE
| C6 | 198 | Æ | LATIN CAPITAL LIGATURE AE
| C7 | 199 | Ç | LATIN CAPITAL LETTER C WITH CEDILLA
| C8 | 200 | È | LATIN CAPITAL LETTER E WITH GRAVE ACCENT
| C9 | 201 | É | LATIN CAPITAL LETTER E WITH ACUTE ACCENT
| CA | 202 | Ê | LATIN CAPITAL LETTER E WITH CIRCUMFLEX ACCENT
| CB | 203 | Ë | LATIN CAPITAL LETTER E WITH DIAERESIS
| CC | 204 | Ì | LATIN CAPITAL LETTER I WITH GRAVE ACCENT
| CD | 205 | Í | LATIN CAPITAL LETTER I WITH ACUTE ACCENT
| CE | 206 | Î | LATIN CAPITAL LETTER I WITH CIRCUMFLEX ACCENT
| CF | 207 | Ï | LATIN CAPITAL LETTER I WITH DIAERESIS
|    |     |   |
| D0 | 208 | Ð | LATIN CAPITAL LETTER ETH
| D1 | 209 | Ñ | LATIN CAPITAL LETTER N WITH TILDE
| D2 | 210 | Ò | LATIN CAPITAL LETTER O WITH GRAVE ACCENT
| D3 | 211 | Ó | LATIN CAPITAL LETTER O WITH ACUTE ACCENT
| D4 | 212 | Ô | LATIN CAPITAL LETTER O WITH CIRCUMFLEX ACCENT
| D5 | 213 | Õ | LATIN CAPITAL LETTER O WITH TILDE
| D6 | 214 | Ö | LATIN CAPITAL LETTER O WITH DIAERESIS
| D7 | 215 | × | MULTIPLICATION SIGN
| D8 | 216 | Ø | LATIN CAPITAL LETTER O WITH STROKE
| D9 | 217 | Ù | LATIN CAPITAL LETTER U WITH GRAVE ACCENT
| DA | 218 | Ú | LATIN CAPITAL LETTER U WITH ACUTE ACCENT
| DB | 219 | Û | LATIN CAPITAL LETTER U WITH CIRCUMFLEX ACCENT
| DC | 220 | Ü | LATIN CAPITAL LETTER U WITH DIAERESIS
| DD | 221 | Ý | LATIN CAPITAL LETTER Y WITH ACUTE ACCENT
| DE | 222 | Þ | LATIN CAPITAL LETTER THORN
| DF | 223 | ß | LATIN SMALL LETTER SHARP S
|    |     |   |
| E0 | 224 | à | LATIN SMALL LETTER A WITH GRAVE ACCENT
| E1 | 225 | á | LATIN SMALL LETTER A WITH ACUTE ACCENT
| E2 | 226 | â | LATIN SMALL LETTER A WITH CIRCUMFLEX ACCENT
| E3 | 227 | ã | LATIN SMALL LETTER A WITH TILDE
| E4 | 228 | ä | LATIN SMALL LETTER A WITH DIAERESIS
| E5 | 229 | å | LATIN SMALL LETTER A WITH RING ABOVE
| E6 | 230 | æ | LATIN SMALL LIGATURE AE
| E7 | 231 | ç | LATIN SMALL LETTER C WITH CEDILLA
| E8 | 232 | è | LATIN SMALL LETTER E WITH GRAVE ACCENT
| E9 | 233 | é | LATIN SMALL LETTER E WITH ACUTE ACCENT
| EA | 234 | ê | LATIN SMALL LETTER E WITH CIRCUMFLEX ACCENT
| EB | 235 | ë | LATIN SMALL LETTER E WITH DIAERESIS
| EC | 236 | ì | LATIN SMALL LETTER I WITH GRAVE ACCENT
| ED | 237 | í | LATIN SMALL LETTER I WITH ACUTE ACCENT
| EE | 238 | î | LATIN SMALL LETTER I WITH CIRCUMFLEX ACCENT
| EF | 239 | ï | LATIN SMALL LETTER I WITH DIAERESIS
|    |     |   |
| F0 | 240 | ð | LATIN SMALL LETTER ETH
| F1 | 241 | ñ | LATIN SMALL LETTER N WITH TILDE
| F2 | 242 | ò | LATIN SMALL LETTER O WITH GRAVE ACCENT
| F3 | 243 | ó | LATIN SMALL LETTER O WITH ACUTE ACCENT
| F4 | 244 | ô | LATIN SMALL LETTER O WITH CIRCUMFLEX ACCENT
| F5 | 245 | õ | LATIN SMALL LETTER O WITH TILDE
| F6 | 246 | ö | LATIN SMALL LETTER O WITH DIAERESIS
| F7 | 247 | ÷ | DIVISION SIGN
| F8 | 248 | ø | LATIN SMALL LETTER O WITH OBLIQUE BAR
| F9 | 249 | ù | LATIN SMALL LETTER U WITH GRAVE ACCENT
| FA | 250 | ú | LATIN SMALL LETTER U WITH ACUTE ACCENT
| FB | 251 | û | LATIN SMALL LETTER U WITH CIRCUMFLEX ACCENT
| FC | 252 | ü | LATIN SMALL LETTER U WITH DIAERESIS
| FD | 253 | ý | LATIN SMALL LETTER Y WITH ACUTE ACCENT
| FE | 254 | þ | LATIN SMALL LETTER THORN
| FF | 255 | ÿ | LATIN SMALL LETTER Y WITH DIAERESIS
+----+-----+---+------------------------------------------------------

