From: John Delacour (JD@BD8.COM)
Date: Mon Apr 28 2003 - 10:24:17 EDT
At 5:32 pm +0400 28/4/03, Sheni R. Meledath wrote:
>How can I convert Arabic text typed in Word or Notepad or HTML text
>to Unicode format. In Unicode, I require the Hexadecimal values to
>use in Java Applications. This is used to display error messages in
>Arabic from the JSP scripts in my Arabic web site.
>
>###########
>loginFailed=\u064a\u0631\u062c\u0649
>\u0627\u0644\u0645\u062d\u0627\u0648\u0644\u0629
>\u0645\u062c\u062f\u062f\u062727
>###########
Here's how I'd do it on the Mac. All you need essentially is to
change the back-slashes to "&#x" and append ";" to the byte-pair.
#!/usr/bin/perl
# or whatever shebang ActivePerl requires...
# ... anything, probably.
$_ = q@
\u064a\u0631\u062c\u0649 \u0627\u0644\u0645
\u062d\u0627\u0648\u0644\u0629 \u0645\u062c
\u062f\u062f\u06272
@ ;
s~$/~~g ; # removes line endings from above
# you'll need a Win32 path string here:-
my $htmlfile = "/tmp/arabic.html" ;
# convert to html character entities
s~\\u([0-9a-f][0-9a-f][0-9a-f][0-9a-f])~\&\#x$1\;~gi;
# write the html stuff=
open HTML, ">$htmlfile";
print HTML << "END_OF_HTML" ;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"
"http://www.w3.org/MarkUp/Wilbur/HTML32.dtd">
<html>$/
$_$/
</html>
END_OF_HTML
# You'll need to open it the Win32 way
#
`open $htmlfile` ;
This archive was generated by hypermail 2.1.5 : Mon Apr 28 2003 - 11:01:59 EDT