Arabic pronounce symbol not showing correctly - java

Im trying to put text with arabic letters, some of the text working correctly, and the others symbol is showing weirdly.
Some of the letters just font issue, i can still tolerate if it fix all the mistakenly displayed symbol.
I tried to change font, putting on string, custom font, but it does not work. Any ideas guys ?
i put the pull the text from string res currently.
here is the wrong letters.
here is the correct letters

You should use custom font for your view..
For example this view support TextView custom font from assets.

If you were wondering what encoding would be most efficient:
All Arabic characters can be encoded using a single UTF-16 code unit (2 bytes), but they may take either 2 or 3 UTF-8 code units (1 byte each), so if you were just encoding Arabic, UTF-16 would be a more space efficient option.

Related

How to input Japanese text into Java Swing component with IBus-Anthy

I'm trying to type Japanese characters with the IBus-Anthy Hiragana input method on Ubuntu into a JTextField. However, even when I have this method selected (and it works in other applications), my input just appears as Latin characters.
I can copy/paste Japanese text into the text field, and display Japanese characters in other Swing components with no problem, so I don't think it's an issue with fonts.
Has anyone else encountered this issue? Any help would be greatly appreciated!
EDIT: This same issue also arises with Pinyin. I can type non-Latin characters such as Cyrillic just fine, but I seem to have trouble with anything that requires special composition.

Where do I set the character encoding in a Java Swing application so that I can write Hindi to a MySQL database?

I have a form which contains several fields like textbox, lables, etc.
In text fields I used "Kruti Dev 040 Wide" font to type value in Hindi, But when i save this value to database its shown in English. Please help me out of this problem I want this values in database in Hindi format.
Thanks and regards
Sandeep Sharma
Normally, you'd expect to have to set up your database to store UTF-8, in order to use Devanagari characters (the ones used for Hindi). But the Kruti Dev fonts avoid this issue by doing something slightly nasty. They actually make the Roman letters look like the Devanagari letters. This has the advantage that you can easily type Hindi on a standard English keyboard. But it has the disadvantage that anything that you write in Hindi will, under the covers, be Roman text.
So you have two options.
You can use a Kruti Dev font, but be aware that you'll still be working with Roman text. If you want to display your text, and have it look like Hindi, you'll need to use a Kruti Dev font to display it.
You can abandon the Kruti Dev font, and use UTF-8 characters for the Devanagari characters; making sure, of course, that your database is able to save UTF-8.

Japanese in JTextArea

I have a database with japanese words. Additionaly i have algorithm that reads these words and put them into JTextArea.
Problem is I see rectangles instead of japanese signs.
But when i copy such a set of rectangles (ctrl+c) from JTA and put them into eg. command input of TotalCommander or Winword document, signs appears are displayed properly. But only under Win7.
Because i run Eclipse on Virtual Machine under winXP I have ability of copy rectangles also to command input of TotalCommander under winXP. There are remain rectangles as in my Java app.
It means that there is in JTA an info about particular signs, but JTA can't interpretes this info.
Of course I have installed proper font.
I've tried many way with fonts:
textArea.setFont(new Font(blablabla));
and similar, but without effects.
What should i do?
The Problem with your JTextArea is most-probably, that the font you're using isn't applicable for UTF-8 & Japanese. The font doesn't provide an mapping table from UTF-8 values to characters. i.e. 0x41 is in ASCII, as well as in UTF-8 and even SHIFT-JIS the letter 'A' - but the Font you're just linking, resolves 0x41 to an Kanji character. And the whole font doesn't contain Hiragana and Katakana characters at all - please see also the comments section on the site where you got this font from here.
After using ChapMap it has a WSIfonts TAG and does NOT! support ALL the Chinese characters it only has 90 characters and assigns 1 character per Char except Caps.
It's a chinese font - not a Japanese one. But it won't even provide all chinese characters and has no useful mapping table included - so it's pretty useless.
Try to use another font - that should work just fine, if it contains really japanese characters and provides an applicable mapping table for UTF-8.
You can find fonts, that would work i.e. here

Print unique ascii characters in eclipse console

Kind of a strange question but... here it goes.
Recently my application threw an IOException that the text only had a clubs symbol in it (like the suit in cards) I know this is probably because there was a number in there that was cast to a char and printed to the screen, and I've found where that might have happened. The only problem is, I can't recreate it in eclipse because the eclipse console doesn't want to print those characters for me. All I get are boxes.
I figure this is an encoding issue or something but I need eclipse to print out those characters just like the windows console would. Is there a setting I can change to do this?
The respective Unicode character is U+2663. Just print "\u2663" and you should be fine. This has nothing to do with ASCII, though.
If you get boxes it may also be a font issue. If the font you selected for the console view in Eclipse does not have a glyph for that code point you'll get boxes, usually. The character might still correctly printed, though. Usually monospaced fonts have that character, though, since it was historically part of the glyphs for the control characters below character code 32 (not that control characters ever had the intention of a visual appearance, but well, they could be in the screen buffer, so someone thought it would be a good idea to display them as well).

How Can I detect Unknown/Unassigned Unicode characters in my java program?

I want to write a java program to print Unicode characters. I want to detect and not print Unknown/Unassigned CHaracters (which are shown by a rectangular). I have tried "isDefined" and "isISOControl" from "Character" class, but it does not work.
Does anybody know the solution? it will be a big help for me.
Thanks.
The characters that are shown as a rectangle (on Windows) are ones that aren't available in the font you're using. While you could filter out a lot of them by filtering out undefined and control characters, it's entirely possible that the problem you're running into is that your font doesn't support certain ranges of valid characters (which is typical -- very few fonts define glyphs for all defined Unicode characters).
If your goal is really to remove characters that render as a rectangle, you can use the canDisplay method in Font.

Categories

Resources