Posts by heraclite

1 post
  • Has been a member for 5-6 years
heraclite says

Depending on the context, if HTML entities don’t work, particularly in Javascript strings, accented characted may be resolved by using the octal notation. Sometimes, two (2) following backslashes may be needed.

á \341 à \340 â \342 ä \344 ã \343 å \345 ç \347 é \351 è \350 ê \352 ë \353 í \355 ì \354 î \356 ï \357 ñ \361 ó \363 ò \362 ô \364 ö \366 õ \365 ø \370 ú \372 ù \371 û \373 ü \374 ÿ \375 Á \301 À \300  \302 à \303 Ä \304 Å \305 Ç \307 É \312 È \311 Ê \312 Ë \313 Í \315 Ì \314 Î \316 Ï \317 Ñ \321 Ó \323 Ò \322 Ô \324 Õ \325 Ö \326 Ø \330 Ú \332 Ù \331 Û \333 Ü \334 Ÿ \355 Æ \306 æ \346 Œ \214 œ \234 ß \337 ¿ \277 ¡ \241   \240 (this one is non-breaking space, also known as  )

I use this PERL script (with BBedit) to do the job :

!/usr/bin/perl -w

my $i = 0; while(<>) { $i++; $line = $_; $line =~ s/á/\\341/g; $line =~ s/à/\\340/g; $line =~ s/â/\\342/g; $line =~ s/ä/\\344/g; $line =~ s/ã/\\343/g; $line =~ s/å/\\345/g; $line =~ s/ç/\\347/g; $line =~ s/é/\\351/g; $line =~ s/è/\\350/g; $line =~ s/ê/\\352/g; $line =~ s/ë/\\353/g; $line =~ s/í/\\355/g; $line =~ s/ì/\\354/g; $line =~ s/î/\\356/g; $line =~ s/ï/\\357/g; $line =~ s/ñ/\\361/g; $line =~ s/ó/\\363/g; $line =~ s/ò/\\362/g; $line =~ s/ô/\\364/g; $line =~ s/ö/\\366/g; $line =~ s/õ/\\365/g; $line =~ s/ø/\\370/g; $line =~ s/ú/\\372/g; $line =~ s/ù/\\371/g; $line =~ s/û/\\373/g; $line =~ s/ü/\\374/g; $line =~ s/ÿ/\\375/g; $line =~ s/Á/\\301/g; $line =~ s/À/\\300/g; $line =~ s/Â/\\302/g; $line =~ s/Ã/\\303/g; $line =~ s/Ä/\\304/g; $line =~ s/Å/\\305/g; $line =~ s/Ç/\\307/g; $line =~ s/É/\\312/g; $line =~ s/È/\\311/g; $line =~ s/Ê/\\312/g; $line =~ s/Ë/\\313/g; $line =~ s/Í/\\315/g; $line =~ s/Ì/\\314/g; $line =~ s/Î/\\316/g; $line =~ s/Ï/\\317/g; $line =~ s/Ñ/\\321/g; $line =~ s/Ó/\\323/g; $line =~ s/Ò/\\322/g; $line =~ s/Ô/\\324/g; $line =~ s/Õ/\\325/g; $line =~ s/Ö/\\326/g; $line =~ s/Ø/\\330/g; $line =~ s/Ú/\\332/g; $line =~ s/Ù/\\331/g; $line =~ s/Û/\\333/g; $line =~ s/Ü/\\334/g; $line =~ s/Ÿ/\\355/g; $line =~ s/Æ/\\306/g; $line =~ s/æ/\\346/g; $line =~ s/Œ/\\214/g; $line =~ s/œ/\\234/g; $line =~ s/ß/\\337/g; $line =~ s/¿/\\277/g; $line =~ s/¡/\\241/g; $line =~ s/ /\\240/g; print $line; }

There may be a more elegant way to do it somewhere ! Hope this will help you

by
by
by
by
by
by