3

I need to write Arabic words as labels inside a .pm file. It is not working for me. I tried ASCII letters and they worked. Is there a better way to do so?

I tried something like:

<span dir="rtl" lang="ar">&#1593;&#1585;&#1576;&#1610;</span>
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Luci
  • 3,174
  • 7
  • 31
  • 36
  • 2
    That is HTML, not Perl. The best way is probably "Move your HTML to a template file and get it out of your program logic". – Quentin Sep 30 '10 at 10:09
  • @David: what does this template file has to be? and how I would include it inside perl file? – Luci Sep 30 '10 at 10:24
  • 3
    There are a number of template mechanisms available for Perl. I would use Template-Toolkit (http://search.cpan.org/perldoc?Template / http://template-toolkit.org/). Other options include HTML::Template (http://search.cpan.org/perldoc?HTML::Template) – Quentin Sep 30 '10 at 10:36
  • 3
    Also see [How can I embede chinese characters in my Perl source?](http://stackoverflow.com/q/1945221#1945756). This works: `use utf8; $string = 'عربي';` – daxim Sep 30 '10 at 13:06
  • I have an arabic example in the Unicode chapter of _Effective Perl Programming_. :) – brian d foy Sep 30 '10 at 17:59

1 Answers1

10
use utf8;

tells Perl that your program is written with utf-8 encoding. Do not use encoding pragma - it is broken.

Alexandr Ciornii
  • 7,346
  • 1
  • 25
  • 29