How Preeti to Unicode Converter Works?

Mukund Shah

February 05, 2021
Last updated February 10, 2022

With the help of few programming techniques, text from any font, which disguise itself as a language other than English, can be converted to actual Unicode characters. In our case, the font is Preeti, and the language is Nepali.

How does conversion work?

The answer, in layman's terms, is through character mapping. 

Programmers create a  two-column table in which they tell computers to output the assigned character for a given input. 

In the left column, the English characters, and punctuation will be listed row-wise. In the right column, the corresponding Unicode character will be listed. So as for Preeti font, 's' renders as 'क', 's' will be in the left column and 'क' will be in the right column.

Excerpt of a codebase used to convert Preeti to Unicode

The characters on the left side are the English characters, earlier disguised as Nepali characters through Preeti font, and the corresponding Unicode characters are on the right side. 

Click here to view the full code of Preeti to Unicode Converter.

In a similar way, Unicode characters are mapped to respective English characters which will then appear as Nepali characters when the font for the converted text will be set to Preeti.

Download Preeti font from here.

Also Read: