The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

Convert European characters to HTML

Contributed by: Jean
This tip is valid for: Both BeOS and Haiku

To get extended European characters such as é è ù ß and Å to render properly in HTML, you need to represent them with extended HTML codes. Rather than relying on clunky look-up charts, create a simple sed script to do the hard work for you.

Save the two files below to /boot/home/config/bin. To use the system, assume you have a text document called MyFile. Open a Terminal window in that file’s directory and type:

convert MyFile

A second file will appear in the same directory, called MyFile.new. This second file will have all European extended characters replaced with their HTML equivalents. Now you can write J.L Gassée in an HTML page without mispelling. :)

Here are the two files you need to create:

Save this first one as /boot/home/config/bin/convert:

——————

file="$*"
sed -f "/boot/home/config/bin/convhtml.sed" $file > $file.new

——————

Save this second one as /boot/home/config/bin/convhtml.sed (note that
you must be using a font capable of handling all extended characters in order
for this to be displayed properly).

——————

s/¡/\¡/g
s/¢/\¢/g
s/£/\£/g
s/¤/\¤/g
s/¥/\¥/g
s/¦/\¦/g
s/§/\§/g
s/¨/\¨/g
s/©/\©/g
s/ª/\ª/g
s/«/\«/g
s/¬/\¬/g
s/®/\®/g
s/¯/\¯/g
s/°/\°/g
s/±/\±/g
s/²/\²/g
s/³/\³/g
s/´/\´/g
s/µ/\µ/g
s/¶/\¶/g
s/·/\·/g
s/¸/\¸/g
s/¹/\¹/g
s/º/\º/g
s/»/\»/g
s/¼/\¼/g
s/½/\½/g
s/¾/\¾/g
s/¿/\¿/g
s/À/\À/g
s/Á/\Á/g
s/Â/\Â/g
s/Ã/\Ã/g
s/Ä/\Ä/g
s/Å/\Å/g
s/Æ/\Æ/g
s/Ç/\Ç/g
s/È/\È/g
s/É/\É/g
s/Ê/\Ê/g
s/Ë/\Ë/g
s/Ì/\Ì/g
s/Í/\Í/g
s/Î/\Î/g
s/Ï/\Ï/g
s/Ð/\Ð/g
s/Ñ/\Ñ/g
s/Ò/\Ò/g
s/Ó/\Ó/g
s/Ô/\Ô/g
s/Õ/\Õ/g
s/Ö/\Ö/g
s/×/\×/g
s/Ø/\Ø/g
s/Ù/\Ù/g
s/Ú/\Ú/g
s/Û/\Û/g
s/Ü/\Ü/g
s/Ý/\Ý/g
s/Þ/\Þ/g
s/ß/\ß/g
s/à/\à/g
s/á/\á/g
s/â/\â/g
s/ã/\ã/g
s/ä/\ä/g
s/å/\å/g
s/æ/\æ/g
s/ç/\ç/g
s/è/\è/g
s/é/\é/g
s/ê/\ê/g
s/ë/\ë/g
s/ì/\ì/g
s/í/\í/g
s/î/\î/g
s/ï/\ï/g
s/ð/\ð/g
s/ñ/\ñ/g
s/ò/\ò/g
s/ó/\ó/g
s/ô/\ô/g
s/õ/\õ/g
s/ö/\ö/g
s/÷/\÷/g
s/ø/\ø/g
s/ù/\ù/g
s/ú/\ú/g
s/û/\û/g
s/ü/\ü/g
s/ý/\ý/g
s/þ/\þ/g
s/ÿ/\ÿ/g

——————

Posted in Scripting

Comment on this tip

Comments may be incorporated into the original tip by site editors.

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.