This program reads in a sentence. It then takes out all the a^ o^ etc out, cos some people may use them to do â or ô etc cos they don't know how. It then changes it to the \xe2 equiv so that a spell checker can check it, and display the correct result. I've started byt changing â, cos i forgot to put "" instead of ''. Use the â as example.
use strict ; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use HTML::Template; use Data::Dumper; use Unicode::String; my $q = new CGI; sub accentmatch() { my $brawddeg = shift; $brawddeg =~ s/([aeiouwy][\"\^\`\/])/utf($1)/ge; return $brawddeg; } sub utf() { my $acen = shift; my $transacen; my %conv = ('a^'=>"\xe2", 'e^'=>'\x0EA', 'i^'=>'\x0EE', 'o^'=>" +\x0f4", 'u^'=>'\0FB', 'w^'=>"\x175", 'y^'=>'\x177', 'a"'=>'\x0E4', 'e"'=>'\x0EB', 'i"'=>'\x0EF', 'o"'=>'\x0 +F6', 'u"'=>'\0FC', 'w"'=>'\x1E85', 'y"'=>'\xff', 'a/'=>'\x0E1', 'e/'=>'\x0E9', 'i/'=>'\x0ED', 'o/'=>'\x0 +F3', 'u/'=>'\0FA', 'w/'=>'\x1E83', 'y/'=>'\xfd', 'a\''=>'\x0E0', 'e\''=>'\x0E8', 'i\''=>'\x0EC', 'o\''=>'\x +0F2', 'u\''=>'\0F9', 'w\''=>'\x1E81', 'y\''=>'\x1EF3', 'A^'=>'\x0C2', 'E^'=>'\x0CA', 'I^'=>'\x0CE', 'O^'=>'\x0 +D4', 'U^'=>'\0DB', 'W^'=>'\x174', 'Y^'=>'\x176', 'A"'=>'\x0C4', 'E"'=>'\x0CB', 'I"'=>'\x0CF', 'O"'=>'\x0 +D6', 'U"'=>'\0DC', 'W"'=>'\x1E84', 'Y"'=>'\x178', 'A/'=>'\x0C1', 'E/'=>'\x0C9', 'I/'=>'\x0CD', 'O/'=>'\x0 +D3', 'U/'=>'\0DA', 'W/'=>'\x1E82', 'Y/'=>'\xdd', 'A\''=>'\x0C0', 'E\''=>'\x0C8', 'I\''=>'\x0CC', 'O\''=>'\x +0D2', 'U\''=>'\0D9', 'W\''=>'\x1E80', 'Y\''=>'\x1EF2'); die unless $conv{$acen}; return( $conv{$acen} ); }
But if I enter words like tân, i get t(square thing - the cannot diplay symbol symbol). Any ideas? Thanks for your help. P.s. I know I don't need most of the stuff at the top but ignore that.

In reply to Showing â,ô etc in HTML by COMSCBoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.