Encode::Arabic(3pm)

πŸ“¦
version 14.2 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Encode::Arabic πŸ’–

okay bestie, gather round, because we're talking about the Perl module for Arabic encodings β€” Encode::Arabic. That's the whole NAME situation: Encodings of Arabic. Short, iconic, does exactly what it says. πŸŽ€


✨ SYNOPSIS ✨

use Encode::Arabic;                 # imports just like 'use Encode' even with options would

while ($line = <>) {                # renders the ArabTeX notation for Arabic both in the ..

    print encode 'utf8', decode 'arabtex', $line;          # .. Arabic script proper and the
    print encode 'utf8', decode 'arabtex-zdmg', $line;     # .. Latin phonetic transcription
}

# 'use Encode::Arabic ":modes"' would export the functions controlling the conversion modes

Encode::Arabic::demode 'arabtex', 'default';
Encode::Arabic::enmode 'buckwalter', 'full', 'xml', 'strip off kashida';

# Arabic in lower ASCII transliterations <--> Arabic script in Perl's internal encoding

$string = decode 'ArabTeX', $octets;
$octets = encode 'Buckwalter', $string;

$string = decode 'Buckwalter', $octets;
$octets = encode 'ArabTeX', $string;

# Arabic in lower ASCII transliterations <--> Latin phonetic transcription, Perl's utf8

$string = decode 'Buckwalter', $octets;
$octets = encode 'ArabTeX', $string;

$string = decode 'ArabTeX-ZDMG', $octets;
$octets = encode 'utf8', $string;

🌸 DESCRIPTION 🌸

So basically, this module is a lil wrapper β€” a very cute, very capable wrapper β€” around a bunch of different implementations of the encoding systems used for the Arabic language. And it doesn't stop at Arabic proper either: it covers even some non-Arabic extensions to the Arabic script. πŸ™ˆ

The modules it bundles fit right into the philosophy of Encode::Encoding, which means you can use them directly with the Encode module. No weird middleman behaviour. Slay.

πŸ¦‹ LIST OF ENCODINGS πŸ¦‹

Each of these is a whole vibe, so let's go one by one:

  • ArabTeX β€” the ArabTeX multi-character notation for Arabic on one side, Perl's internal format for the Arabic script on the other. Powered by Encode::Arabic::ArabTeX, and it uses Encode::Mapper.
  • ArabTeX-RE β€” bestie, heads up: this one is deprecated. It's the method using sequential regular-expression substitutions. Limited in scope compared to the full ArabTeX notation, and non-efficient when you're actually processing data β€” but the upside is it does not require the Encode::Mapper module. Lives in Encode::Arabic::ArabTeX::RE.
  • ArabTeX-Verbatim β€” the ArabTeX multi-character verbatim notation for Arabic, mapped against Perl's internal format for the Arabic script. That's Encode::Arabic::ArabTeX::Verbatim, and yes, it uses Encode::Mapper.
  • ArabTeX-ZDMG β€” ArabTeX multi-character notation for Arabic over on one side, Perl's internal format for the Latin phonetic trascription in the ZDMG style on the other. Found in Encode::Arabic::ArabTeX::ZDMG, using Encode::Mapper.
  • ArabTeX-ZDMG-RE β€” another deprecated one 🫠 β€” sequential regular-expression substitutions again. Limited in scope over the ArabTeX notation and non-efficient in data processing, but it doesn't need the Encode::Mapper module. It's Encode::Arabic::ArabTeX::ZDMG::RE.
  • Buckwalter β€” Buckwalter one-to-one notation for Arabic mapped to Perl's internal format for the Arabic script. That's Encode::Arabic::Buckwalter.
  • Parkinson β€” Parkinson one-to-one notation for Arabic over Perl's internal format for the Arabic script. That's Encode::Arabic::Parkinson.
  • Habash β€” the Habash-Soudi-Buckwalter one-to-one notation for Arabic against Perl's internal format for the Arabic script. That's Encode::Arabic::Habash.

There are generic aliases to all of these provided by Encode, and here's the tea: case does not matter, and all characters of the class [ _-] are interchangeable. So mix and match your separators, go off. πŸ’…

Also, quick note: the standard Encode module already handles several other single-byte encoding schemes for Arabic that are popular with whichever operating system you're on β€” *n*x, Windows, DOS or Macintosh. For their identification names and aliases, go look at Encode::Supported and Encode::Byte.

πŸ‘‘ EXPORTS & MODES πŸ‘‘

The module exports as if use Encode also appeared in the calling package. The import options are just delegated to Encode and the imports get performed properly β€” with one exception: the :modes option coming first in the list. In that case, the following functions get introduced into the namespace of the importing package:

  • enmode ($enc, @list) β€” calls the enmode method associated with the given $enc encoding, and passes the @list to it. The idea is similar to the encode functions and methods of the Encode and Encode::Encoding modules respectively. This is your control panel for the modes of conversion.
  • demode ($enc, @list) β€” the exact analogue of enmode, except it calls the appropriate demode method instead. See the individual implementations of the listed encodings for the deets.

πŸ’œ SEE ALSO πŸ’œ


🫢 AUTHOR 🫢

Otakar Smrz "<otakar-smrz users.sf.net>", <http://otakar-smrz.users.sf.net/>


Copyright (C) 2003-2016 Otakar Smrz

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie ✨ this was Encode::Arabic(3pm) from the User Contributed Perl Documentation, written against perl v5.36.0 and dated 2022-10-16 β€” go forth and encode, you absolute icon πŸ‘‘πŸ’–

πŸ“¦ where this page comes from