I want to create application which will be transliteration of same, arabic to english. (by convert I mean writing roman arabic to roman english)
For that I need user input in arabic in Text area. IF user writes in particular text area it should automatically write in arabic only.
see this example: https://translate.google.com/#ar/en/%D9%84%D9%8A%D9%85%D8%A7%D9%86
How this can be done?
My ultimate goal is performing Arabic Romanization using Beirut System
Arabic is relatively easy to transliterate to Latin script. There are a few widely used standards for this, which are mostly 1-on-1 mappings of the arabic character to a latin character. They are mentioned here: http://en.wikipedia.org/wiki/Romanization_of_Arabic
The PECL intl package has transliteration support. If you can't use that, you can have a look at the excellent Drupal Transliteration module for a PHP implementation (I suggest you download 7.x-3.2, scroll down the page to find it).
You will need a code that will translate the arabic to english. In PHP
This can be done using language processing. This is a really big topic we, and it's not classified as a problem. Or you can use an API such as Google Translate to get the translation back.
You will need one text area and one container that will hold the translation.
You will need an AJAX code that will send to the server the current content of the text area, and get back the translation.
The trigger should be onKeyUp
Related
I have a form where a text should be converted to japanese characters, I am manually converting the text into japanese and stores it in the database. However, characters are not translated as it should be? My question is what text helper should i use to store japanese characters in the database and output it right in the web? Also, what method should i use to convert submitted text in a form and convert it into japanese, maybe just like google translate?
You can try Google translate API (documetation). Its a paid service, no free quota (See here). I'm not sure how much accuracy it will give you.
im going to write a mail server script with php language and mysql database.i have to put search im emails tools in my programming TODO but there is a problem
there are some words with the same style and different encoding in some language
for example كتابي and کتابی or کبک and كبك
these work can be used for each other by the user computer keyboard layout
the كتابي and كبك are with arabic layout
but کتابی and کبک are in persian layout
i tried to find and change one language words to other one with str_replace function but this is not very useful because i dont know these type of words in all language over the world
there isnt any standard for these type of words?!
I am ignorant of Arabic and Farsi so I don't understand the difference between the end-of-word letters ي and ی. The first one, which is from your Arabic example, has a diacritical mark below it, and the second one doesn't.
It's clear, however, that these characters are unicode-encoded. It's not the keyboard specifically that you're dealing with, it's the unicode characters encoded by the keyboard. The Arabic and Farsi interpretations of the letters are not the same as each other.
The first one is 064A: http://www.fileformat.info/info/unicode/char/064a/index.htm
The second one is 06CC: http://www.fileformat.info/info/unicode/char/06cc/index.htm
Doing this on your column
SELECT CONVERT(table.word USING cp1256)
FROM table
will put in replacement characters (?) for the Farsi letters (the letters absent from the Arabic code page cp1256), e.g. turning کتابی into ?تاب?. That may help you detect which letters you need to work with.
You are going to need to develop a transliteration scheme, however. It may be a certain amount of work.
I saw a website like this i.e. http://www.a3malcom.com/index.php. I want to build same kind of website in Arabic website. I was wondering does entries into database table also needs to be done in Arabic or English?
What if i need the website in 2 languages i.e. english and arabic. In what language should data should be entered in DB.
Take a look at comprehensive article: (Thanks to #Deceze for great article)
Handling Unicode Front To Back In A Web App
It also has Arabic example with other languages:
Yes you should insert data in Arabic in db table. So you can read it easily in web page and no need to convert.
And use utf-8 encoding while displaying the page
Usually unicode is all that is needed (UTF-8).
Your source file should be encoded UTF-8 if you want to write arabic in the PHP source. Note that some text editors don't support arabic properly.
For the database, just create your database with UTF-8 encoding.
For HTML output, add this to your HEAD section:
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
Alternatively, you can send it as HTTP header... but why bother.
Anyway, I have encoutered a problem generating Arabic sentences as images in GD - using a custom font. Turns out GD doesn't render arabic properly (at least in my case).
That was solved using the following library:
http://ar-php.org/
(yes the website is pretty ugly, but the library works, is well packaged, contains documentation...)
All I had to do, in my case, to fix the problem, is:
$Arabic = new I18N_Arabic('Glyphs');
$text = $Arabic->utf8Glyphs($_GET['txt']);
And then feed $text to GD.
I'm encountering a minor problem with text direction, though, and looking for a solution. But at least I have valid arabic now.
But in most cases you won't need that library, but will just need to make sure that you're using UTF-8 in all your development process.
Hope it helps.
I have developed a Quiz Contest Website in which admin can create questions and then those questions will be displayed .The Below is one of the question
The above is a question which admin will enter but as you can see there are special characters such as Square Root Symbol and equilibrium sign.Please help me on this how admin can enter above question in the admin site.
I have a HTML Editor for entering question and have text boxes to enter it's options.
There is a relatively new html5 library called MathML. See MathML on wikipedia
You can also play with unicode to achieve at least some of the symbols. see this example link
In general its best to just upload images that contain those special symbols. you can easily generate this kind of equations with latex.
The methods of entering special characters such as ⇌ (U+21CC) and √ (U+221A) depend on the environment: operating system, keyboard settings, installed auxiliary software, etc. You might consider linking to instruction pages such as http://www.fileformat.info/tip/microsoft/enter_unicode.htm but basically this is something that each user has to solve himself, unless you wish to enhance your HTML editor with special functionality.
(The vinculum associated with the square root sign cannot be produced directly at the character level – combining overline isn’t really suitable for it –, and although it can drawn in various ways, it probably does not pay off in a context like this.)
Your HTML editor of course needs to be Unicode-enabled
If I were you, I would write it in MATLAB or word-equation and take a screenshot and upload it as an image. That would be the easiest way.
Okay, so emoji basically shows the above on a computer. Is that another programming language? So how do I put those little boxes into a php file? When I put it into a php file, it turns into question marks and what not. Also, how can I store these in a MySQL without it turning into question marks and other weird things?
how do I put those little boxes into a php file?
Same way as any other Unicode character. Just paste them and make sure you're saving the PHP file and serving the PHP page as UTF-8.
When I put it into a php file, it turns into question marks and what not
Then you have an encoding problem. Work it out with Unicode characters you can actually see properly first, for example ąαд™日本, before worrying about the emoji.
Your PHP file should be saved as UTF-8; the page it produces should be served as Content-Type: text/html;charset:UTF-8 (or with similar meta tag); the MySQL database should be using a UTF-8 collation to store data and PHP should be talking to MySQL using UTF-8.
However. Even handling everything correctly like this, PCs will still not show the emoji. That's because:
they don't have fonts that include shapes for those characters, and
emoji are still completely unstandardised. Those characters you posted are in the Unicode Private Use Area, which means they don't have any official meaning at all.
Each network in Japan uses different character codes for their emoji, mapped to different areas in the PUA. So even on another mobile phone, it probably won't display the correct character, unless you spend ages manually converting emoji codes for different networks. I'm guessing the ones you posted above are from SoftBank (iPhone?).
There is an ongoing proposal led by Google and Apple to collate the different networks' emoji and give them a proper standardised place in Unicode. Until then, getting emoji to display consistently across networks is an exercise in unhappiness. See the character overview from the standardisation work to see how much converting you would have to do.
God, I hate emoji. All that pain for such a load of useless twee rubbish.
This has nothing to do with programming languages, just with encoding and fonts. As a very brief overview: Every character is stored by its character code (e.g.: 0x41 = A, 0x42 = B, etc), which is rendered as a meaningful character on your screen using a font (which says "the character with the code 0x41 should look like this ...").
These emoji occupy the "private use area" of the Unicode table, which is a range of codes that are undefined and free for anyone to use. That makes them perfectly valid character codes, it's just that no standard font has an appropriate character to display for them, since they are undefined. Only the iPhone and other handhelds, mostly in Japan, have appropriate icons for these codes. This is done to save bandwidth; instead of transmitting relatively large image files back and forth, emoji can be transmitted using a single character code.
As for how to store them: They should be storable as is, as long as you don't try to convert them to another encoding, in which case they may get lost. Just be aware that they only make sense on the iPhone and other SoftBank phones in Japan.
Character Viewer http://img.skitch.com/20091110-e7nkuqbjrisabrdipk96p4yt59.png
If you're on OSX you can copy and paste the character into the Character Viewer to find out what it is. I think there's a similar Character Map on Windows (albeit inferior ;-P). You could put it through PHP's ord(), but that only works on ASCII characters. See the discussion on the ord page for UTF8 functions.
BTW, just for the fun of it, these characters display fine on the iPhone as is, because the iPhone has a font which has icons for them:
iPhone http://img.skitch.com/20091110-bjt3tutjxad1kw4p9uhem5jhnk.png
I'm using FF3.5 and WinXP. I see little boxes in my browser, too.
This tells me the string requires a character set not installed on my computer.
When you put the string into a PHP file, the question marks tell you the same thing: your computer doesn't know how to display the characters.
You could store these emoji characters in MySQL if you encoded them differently, probably using UTF-8.
Do a web search for character encoding, as it relates to MySQL.