Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)
closed by

I'm attempting to work with Unicode for the Kannada language, I am working with Python 2.7 when composed the accompanying code: 

print u'\u0cb5\u0ccd\u0c87'

The yield is ವ್ಇ yet I expected to print "vi" in Kannada??

closed

4 Answers

0 votes
by (25.7k points)
selected by
 
Best answer
In Python 2.7, the code print u'\u0cb5\u0ccd\u0c87' will indeed produce the output "ವ್ಇ" which corresponds to the Kannada characters. However, if you intended to print "vi" in Kannada, you need to use the correct Unicode code points for the characters. In Kannada, the characters for "vi" are represented by the Unicode code points '\u0cb5' and '\u0cbf'.

To achieve the desired output, you can modify the code as follows:

print u'\u0cb5\u0cbf'

This should correctly print "ವಿ" which corresponds to "vi" in Kannada. Please note that it is important to use the appropriate Unicode code points for the characters you wish to display.
0 votes
by (26.4k points)

I think, You haven't encoded your string.

I expect, you want below output

>>> print u'\u0cb5\u0CBF'

ವಿ

What you did was to yield (utilizing the complete names that Unicode allocates to these characters): 

  • KANNADA LETTER VA
  • KANNADA SIGN VIRAMA
  • KANNADA LETTER I

I can see the rationale/logic in this however that is not how Unicode functions. The virama ought to be utilized distinctly for consonant bunches/clusters or on the off chance that you have a grouping that closes in a consonant. To join syllables with vowels you need to utilize the syllable along with a consolidating type of the vowel:

  • KANNADA LETTER VA
  • KANNADA VOWEL SIGN I

I recommend perusing the part 9 of the Unicode standard for a total clarification of how to manage South-Asian contents. Chapter 10 can likewise be helpful.

Are you interested to learn the concepts of Python? Join the python training course fast!

0 votes
by (15.4k points)
When working with Unicode for the Kannada language in Python 2.7, the code print u'\u0cb5\u0ccd\u0c87' will output "ವ್ಇ" which represents the Kannada characters. However, if the intention was to print "vi" in Kannada, the correct Unicode code points need to be used. In Kannada, the characters for "vi" are represented by the Unicode code points '\u0cb5' and '\u0cbf'. By modifying the code to print u'\u0cb5\u0cbf', it will correctly display "ವಿ" which corresponds to "vi" in Kannada. It is crucial to utilize the appropriate Unicode code points for the desired characters in order to achieve the expected output.
0 votes
by (19k points)
To print "vi" in Kannada using Python 2.7 and Unicode, you should use the correct Unicode code points. The code print u'\u0cb5\u0cbf' will display the desired output as "ವಿ", representing "vi" in Kannada. Make sure to utilize the accurate Unicode code points for the specific characters to achieve the expected result.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
asked Mar 31, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...