#------------------------------------------------------------------------------
# eso_util.pl
# Various localy developed utilities utilities
# 
# Author :  Bo Frese Rasmussen [ST-ECF]   <bfrasmus@eso.org>
#------------------------------------------------------------------------------


# Convert tex style special characters to the equivalent HTML character.
# ref.: http://arch-http.hq.eso.org/bfrasmus/web/html_chars.html

sub textohtml
{
    local ( $str ) = @_;

    $str =~ s/\\"{u}/&uuml;/g;
    $str =~ s/\\"{U}/&Uuml;/g;
    $str =~ s/\\"{a}/&auml;/g;
    $str =~ s/\\"{A}/&Auml;/g;
    $str =~ s/\\"{o}/&ouml;/g;
    $str =~ s/\\"{O}/&Ouml;/g;
    $str =~ s/\\'{e}/&eacute;/g;
    $str =~ s/\\'{E}/&Eacute;/g;
    $str =~ s/\\"u/&uuml;/g;
    $str =~ s/\\"U/&Uuml;/g;
    $str =~ s/\\"a/&auml;/g;
    $str =~ s/\\"A/&Auml;/g;
    $str =~ s/\\"o/&ouml;/g;
    $str =~ s/\\"O/&Ouml;/g;
    $str =~ s/\\'e/&eacute;/g;
    $str =~ s/\\'E/&Eacute;/g;
    $str =~ s/{\\o}/&oslash;/g;
    $str =~ s/{\\O}/&Oslash;/g;

    return ( $str );
}

# Convert text string to uppercase.

sub toupper { 
    local($x) = @_;
    $x =~ tr/a-z/A-Z/; 
    return $x
};

1;
