How do i display a kannada unicode letters into its ASCII value using matlab code

I have a kannada unicode letters i want it to convert it in ASCII value and display.How can i do that can anyone suggest any idea or a command to do that?

1 Comment

ASCII only defines characters from 0 to 127, consituting some control characters, punctuation, Arabic digits and the Latin letters.

Sign in to comment.

 Accepted Answer

Why do you want to convert to ASCII?
MATLAB's native character representation is Unicode, not ASCII. You can display the characters using the Unicode values directly. However, you do need to choose a font which contains glyphs for Kannada. If your font doesn't, then you'll get those boxes which are known as "tofu".
c = char(3218:3240);
text(.5,.5,c,'HorizontalAlignment','center','FontName','Arial Unicode MS','FontSize',18)

10 Comments

Thank you for the response, but i am unable to make it display by the code command which you have given.It is showing some error message.Do i need to make any settings in my system and how the input should to be given?please suggest
What error message?
It is possible you don't have that font. As I said, you'll need to find a font that is installed on your system that has glyphs for the range of unicode values you're using. Not all fonts have them, and not all machines have the same fonts installed.
Also, as Walter asked above, what version of MATLAB and what operating system are you using? These matter quite a bit.
I Have installed R2014b and i got kannada characters plot exactly as Mr.Mike Garrity has mentioned above but i am not getting the results for Mr.Walter's code but i wish to get results for that i am getting boxes instead of unicodes in workspace can i get any suggestion.
Though I am getting the kannada unicodes display but in some cases i want combination of the characters combinely means char(3205) shld combine with char(3202) like wise even many other combinations are required to write a sentence in kannada please do suggest any solution.
I'm going to switch to hex here, because that's the convention for most Unicode work.
So you're saying that you've got 0C85 followed by 0C82 , and they're not getting combined into a single glyph? That sounds like a bug. What font are you using?
We're probably going to pass this off to MathWorks support and find someone who knows more about this than I do, but here's my attempt to repro:
c = {[char(hex2dec('0C85')) char(hex2dec('0C81'))]; ...
[char(hex2dec('0C85')) char(hex2dec('0C82'))]; ...
[char(hex2dec('0C85')) char(hex2dec('0C83'))]; ...
[char(hex2dec('0C85')) char(hex2dec('0CC6'))]};
t = text(.5,.5,c,'FontSize',24,'FontName','Nirmala UI')
My understanding is the following:
  • The first line is incorrect because the font is missing a glyph for 0C81, which I think should be a combining character. Because it was missing, we got what's called tofu.
  • The second and third lines look right to me.
  • The fourth line looks incorrect. I think that 0cc6 should be combined with 0c85.
Does that sound right to you?
So I think that I was just misunderstanding the Kannada combining rules in my previous comment. The following loops over all of the consonants and all of the vowel signs.
vowels = {'0c85', '0c86', '0c87', '0c88', '0c89', '0c8a', '0c8b', ...
'0c8c', 'oc8e', '0c8f', '0c90', '0c92', '0c93', '0c94'};
consonants = {'0c95', '0c96', '0c97', '0c98', '0c99', '0c9a', ...
'0c9b', '0c9c', '0c9d', '0c9e', '0c9f', '0ca0', ...
'0ca1', '0ca2', '0ca3', '0ca4', '0ca5', '0ca6', ...
'0ca7', '0ca8', '0caa', '0cab', '0cac', '0cad', ...
'0cae', '0caf', '0cb0', '0cb1', '0cb2', '0cb3', ...
'0cb5', '0cb6', '0cb7', '0cb8', '0cb9'};
vowel_signs = {'0cbe', '0cbf', '0cc0', '0cc1', '0cc2', '0cc3', ...
'0cc4', '0cc6', '0cc7', '0cc8', '0cca', '0ccb', ...
'0ccc'};
figure('Color','white','Position',[400 400 850 450])
axes('Position',[0 0 1 1])
for i=1:length(consonants)
for j=1:length(vowel_signs)
text(i,j,char([hex2dec(consonants{i}), ...
hex2dec(vowel_signs{j})]), ...
'FontName','Noto Sans Kannada', ...
'HorizontalAlignment','center');
end
end
xlim([0, length(consonants)+1])
ylim([0, length(vowel_signs)+1])
axis off
They all appear to be combining correctly.
Note that this is a case where the quality of your font matters a lot. I downloaded one of Googles Noto fonts. These tend to be very reliable on special Unicode features such as combining diacritical marks.
Sir, I want to display Malayalam text in Matlab in the input dialogue box for the text to speech conversion system. I did the above program by changing the character value(from char(3333)) it displayed the text as a graphical representation. But for a speech synthesizer after running the program It will give a box to type the required Malayalam text. It display the text as squares, not displaying the Malayalam letters. Is there is any code to display Malayalam??
When I try with a uicontrol('style','edit') on OS-X 10.11 (El Capitan) and MATLAB R2018a, and I enter in ಾಷೆ then I do not get just squares. The combining of characters is perhaps not done properly in that box, but it is not just squares.
If I recall correctly you are using MS Windows, and a slightly older release of MATLAB. You have also mentioned problems with getting the correct output at the command window. I suspect you might not have the proper font installed. OS-X tends to have well-populated fonts for many of the possible fonts, whereas on MS Windows it was not uncommon for fonts to be only populated with the language they were directly targeted at, with the expectation being that you would switch fonts to display characters from a different language family.
where should I put this command when I am using a complete code?? I didn't get the output correctly, still it showing squares.
You have a font problem. Commands cannot fix that.

Sign in to comment.

More Answers (1)

kannada unicode letters are entirely beyond the range of ASCII values. ASCII formally defines only the character positions numbered 0 to 126 (or 127, depending which edition.)

7 Comments

Then atleast kannada unicode should have a key code other than ascii..is that correct..If so then what could be the key code for kannada unicode which a processor can understand and can be able to display?
>> c = char(3200:3327)
c =
ಀಁಂಃ಄ಅಆಇಈಉಊಋಌ಍ಎಏಐ಑ಒಓಔಕಖಗಘಙಚಛಜಝಞಟಠಡಢಣತಥದಧನ಩ಪಫಬಭಮಯರಱಲಳ಴ವಶಷಸಹ಺಻಼ಽಾಿೀುೂೃೄ೅ೆೇೈ೉ೊೋೌ್೎೏೐೑೒೓೔ೕೖ೗೘೙೚೛೜ೝೞ೟ೠೡೢೣ೤೥೦೧೨೩೪೫೬೭೮೯೰ೱೲೳ೴೵೶೷೸೹೺೻೼೽೾೿
"blobs" in that output reflect the fact that not all code positions have defined characters.
The decimal numbers to use are the same as what are given for the "ALT Codes" shown at http://symbolcodes.tlt.psu.edu/bylanguage/kannadachart.html
Thank you for the response, but i am unable to make it display by the code command which you have given.It is showing some error message.Do i need to make any settings in my system and how the input should to be given?please suggest
What error message shows? Please show the command and the error message. Also, which operating system are you using and which MATLAB release?
Sorry error message is not displaying but when i run the code it is showing just the blobs in workspace,I am using windows 7 ultimate 64- bit and MATLAB R2009b and for Mike Garrity's code i am getting this plot shown below.
Yes, good point.
Early versions of MATLAB did use ASCII. We've been transitioning the system over to using Unicode. That transition was incremental. As Walter says, almost all of the system was switched over by 14b, but in 9b there were lots of areas which were still using ASCII.

Sign in to comment.

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!