如何使用PHP将阿拉伯字符转换为Unicode [英] How to Convert Arabic Characters to Unicode Using PHP
问题描述
我想知道如何将单词转换为unicode,如下所示:
http:/ /www.arabunic.free.fr/
任何人都可以知道如何使用PHP,考虑到阿拉伯文字可能包含连字? b
$ b
感谢
编辑
我'我不确定这是什么unicode,但我需要有阿拉伯字符的等效机器号码,因为阿拉伯字符根据它们的位置具有不同的上下文形式 - 请参阅这里:
http://en.wikipedia.org/wiki/Arabic_alphabet#Table_of_basic_letters
不同位置的同一个字符:
ب| ب| ب| ب
我认为这一定是一种将每个阿拉伯字符转换为相同数字的方法,但怎么做?
编辑
我仍然相信有一种方法可以根据位置将每个字符转换为形式
任何想法都是值得赞赏的。 所有你需要的是函数称为:utf8Glyphs,您可以在ArGlyphs.class.php中找到它从 ar-php
,并访问 Ar-PHP 获取关于项目和类的更多信息。
这将使用与其字符相同的字符(glyphs)来反转这个词。
用法示例:
<?php
include('Arabic.php');
$阿拉伯语=新阿拉伯语('ArGlyphs');
$ text ='بسماللهالرحمنالرحيم';
$ text = $ Arabic-> utf8Glyphs($ text);
echo $ text;
?>
I want to to know how can I convert a word into unicode exactly like: http://www.arabunic.free.fr/
can anyone know how to do that using PHP considering that Arabic text may contains ligatures?
thanks
Edit
I'm not sure what is that "unicode" but I need to have the Arabic Character in it's equivalent machine number considering that arabic characters have different contextual forms depending on their position - see here:
http://en.wikipedia.org/wiki/Arabic_alphabet#Table_of_basic_letters
the same character in different position:
ب | ـب | ـبـ | بـ
I think it must be a way to convert each Arabic character into it's equivalent number, but how?
Edit
I still believe there's a way to convert each character to it's form depending on positions
any idea is appreciated..
All what you need is function called: utf8Glyphs which you can find it in ArGlyphs.class.php download it from ar-php and visit Ar-PHP for the ArPHP more information about the project and classes.
This will reverse the word with same of its characters (glyphs).
Example of usage:
<?php
include('Arabic.php');
$Arabic = new Arabic('ArGlyphs');
$text = 'بسم الله الرحمن الرحيم';
$text = $Arabic->utf8Glyphs($text);
echo $text;
?>
这篇关于如何使用PHP将阿拉伯字符转换为Unicode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!