<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: KrutiDev Tool</title>
    <description>The latest articles on DEV Community by KrutiDev Tool (@krutidevtool).</description>
    <link>https://dev.to/krutidevtool</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4258651%2F167c63fb-4b54-4884-a6e7-c4278d3b9c70.png</url>
      <title>DEV Community: KrutiDev Tool</title>
      <link>https://dev.to/krutidevtool</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krutidevtool"/>
    <language>en</language>
    <item>
      <title>How Kruti Dev to Unicode conversion works (and why the short-i and reph have to move)</title>
      <dc:creator>KrutiDev Tool</dc:creator>
      <pubDate>Sun, 22 Nov 2026 11:35:41 +0000</pubDate>
      <link>https://dev.to/krutidevtool/how-kruti-dev-to-unicode-conversion-works-and-why-the-short-i-and-reph-have-to-move-3e60</link>
      <guid>https://dev.to/krutidevtool/how-kruti-dev-to-unicode-conversion-works-and-why-the-short-i-and-reph-have-to-move-3e60</guid>
      <description>&lt;p&gt;If you have ever opened an old Hindi Word file and seen &lt;code&gt;esjk uke&lt;/code&gt; instead of मेरा नाम, you have met &lt;strong&gt;Kruti Dev&lt;/strong&gt;. It is a legacy Hindi font that is still common in Indian government offices, courts and typing exams. This post explains why Kruti Dev text is not "real" Hindi, and what a converter has to do to turn it into Unicode.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kruti Dev is a font trick, not an encoding
&lt;/h2&gt;

&lt;p&gt;Unicode stores Hindi as Devanagari code points: म is U+092E, े is U+0947, and so on. Any Unicode font (Mangal, Nirmala UI, Noto Sans Devanagari) can draw them.&lt;/p&gt;

&lt;p&gt;Kruti Dev works differently. It stores &lt;strong&gt;plain Latin characters&lt;/strong&gt; and relies on the font to &lt;em&gt;draw&lt;/em&gt; them as Devanagari shapes. The letter &lt;code&gt;e&lt;/code&gt; is drawn as म, &lt;code&gt;s&lt;/code&gt; as the े matra, &lt;code&gt;j&lt;/code&gt; as र, &lt;code&gt;k&lt;/code&gt; as the ा matra. So मेरा is really the four ASCII characters &lt;code&gt;esjk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is why the text breaks the moment the font is missing: WhatsApp, Gmail or a website just shows the raw letters.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Unicode&lt;/th&gt;
&lt;th&gt;Kruti Dev 010 (what is actually stored)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;मेरा नाम&lt;/td&gt;
&lt;td&gt;&lt;code&gt;esjk uke&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;हिंदी भाषा&lt;/td&gt;
&lt;td&gt;&lt;code&gt;fganh Hkk"kk&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;श्री&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Jh&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;प्रधानमंत्री&lt;/td&gt;
&lt;td&gt;&lt;code&gt;iz/kkuea=h&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;भारत सरकार&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Hkkjr ljdkj&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Converting is therefore not a font change. You have to read the Latin characters and rebuild the Devanagari string.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: map keys, longest match first
&lt;/h2&gt;

&lt;p&gt;Most characters map one to one (&lt;code&gt;d&lt;/code&gt; → क, &lt;code&gt;j&lt;/code&gt; → र). But several Devanagari letters take &lt;strong&gt;two or more keys&lt;/strong&gt;: &lt;code&gt;Hk&lt;/code&gt; is भ, &lt;code&gt;vk&lt;/code&gt; is आ, &lt;code&gt;vks&lt;/code&gt; is ओ, and &lt;code&gt;Jh&lt;/code&gt; is श्री. A converter has to try the longest sequence first, otherwise &lt;code&gt;Hk&lt;/code&gt; becomes "H + ा" instead of भ.&lt;/p&gt;

&lt;p&gt;Vowels are a good example. In Kruti Dev the full vowel आ is typed as अ + the ा matra (&lt;code&gt;v&lt;/code&gt; + &lt;code&gt;k&lt;/code&gt;), and ओ as अ + ो (&lt;code&gt;v&lt;/code&gt; + &lt;code&gt;ks&lt;/code&gt;). In Unicode these must become the single letters आ and ओ, not अ followed by a matra. So after mapping, the converter normalises those pairs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: the short-i (ि) comes first
&lt;/h2&gt;

&lt;p&gt;This is the part that trips up naive converters. On a typewriter the short-i matra ि is printed &lt;em&gt;before&lt;/em&gt; the consonant, because that is where it appears visually. Kruti Dev keeps that order: &lt;code&gt;f&lt;/code&gt; (ि) is typed first, then the consonant.&lt;/p&gt;

&lt;p&gt;Unicode does the opposite. It stores the consonant first and the matra after it, and the font moves the ि to the left when drawing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kruti Dev &lt;code&gt;fd&lt;/code&gt; → Unicode क + ि = कि&lt;/li&gt;
&lt;li&gt;Kruti Dev &lt;code&gt;fganh&lt;/code&gt; → Unicode हिंदी&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So whenever the converter sees &lt;code&gt;f&lt;/code&gt;, it has to hold it, read the following consonant (or consonant cluster, like a half letter plus a full letter), and only then emit the ि &lt;strong&gt;after&lt;/strong&gt; that cluster. You can watch this reordering happen live by pasting &lt;code&gt;fganh&lt;/code&gt; into a &lt;a href="https://krutidevtool.com/krutidev-to-unicode/" rel="noopener noreferrer"&gt;Kruti Dev to Unicode converter&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: the reph (र्) comes last
&lt;/h2&gt;

&lt;p&gt;The reph is the small hook on top of a letter, as in कार्य. It is a half र that belongs &lt;em&gt;before&lt;/em&gt; the consonant it sits on. Kruti Dev types it as &lt;code&gt;Z&lt;/code&gt;, and because it is drawn on top of the letter, it is typed &lt;em&gt;after&lt;/em&gt; the letter and its matra.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kruti Dev &lt;code&gt;dk;Z&lt;/code&gt; → Unicode कार्य (र् moves in front of य)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here the converter must move र् backwards, past any matra, to the start of the cluster it belongs to. Get this wrong and you produce text that looks almost right but fails search, sorting and spell-check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: nukta, half letters and the rest
&lt;/h2&gt;

&lt;p&gt;A few smaller rules finish the job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nukta:&lt;/strong&gt; &lt;code&gt;+&lt;/code&gt; after a consonant adds the dot, so &lt;code&gt;d+&lt;/code&gt; → क़.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Half letters:&lt;/strong&gt; many conjuncts have their own key (&lt;code&gt;J&lt;/code&gt; is श्र, &lt;code&gt;=&lt;/code&gt; is त्र, &lt;code&gt;|&lt;/code&gt; is द्य in &lt;code&gt;fo|ky;&lt;/code&gt; → विद्यालय). A standalone halant is typed with &lt;code&gt;~&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digits:&lt;/strong&gt; Kruti Dev shows &lt;code&gt;0-9&lt;/code&gt; as Devanagari digits on screen, but stores ASCII digits. Decide whether you want ० १ २ or 0 1 2 in the output.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A tiny sketch in JavaScript
&lt;/h2&gt;

&lt;p&gt;This is a simplified illustration of the reordering idea, not a full converter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// map: longest Kruti Dev sequences first, e.g. { "vks": "ओ", "Hk": "भ", "d": "क", "k": "ा", ... }&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;krutiToUnicode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt; &lt;span class="cm"&gt;/* sorted longest first */&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="c1"&gt;// short-i: "ि" + consonant cluster  -&amp;gt;  consonant cluster + "ि"&lt;/span&gt;
  &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;ि&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;क&lt;span class="o"&gt;-&lt;/span&gt;ह&lt;span class="p"&gt;]&lt;/span&gt;़&lt;span class="o"&gt;?&lt;/span&gt;्&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;क&lt;span class="o"&gt;-&lt;/span&gt;ह&lt;span class="p"&gt;]&lt;/span&gt;़&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"$1ि"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// reph: cluster (+ matras) + "र्"  -&amp;gt;  "र्" + cluster (+ matras)&lt;/span&gt;
  &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;क&lt;span class="o"&gt;-&lt;/span&gt;ह&lt;span class="p"&gt;]&lt;/span&gt;़&lt;span class="o"&gt;?&lt;/span&gt;्&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;क&lt;span class="o"&gt;-&lt;/span&gt;ह&lt;span class="p"&gt;]&lt;/span&gt;़&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;ा&lt;span class="o"&gt;-&lt;/span&gt;ौ&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;र्&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"र्$1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A production converter needs more care (vowel normalisation, chandrabindu, punctuation like &lt;code&gt;A&lt;/code&gt; for ।, and many conjunct keys), but the two regular expressions show the core problem: Kruti Dev stores visual order, Unicode stores logical order.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it or reuse the table
&lt;/h2&gt;

&lt;p&gt;Going the other way needs the opposite moves: the converter has to push ि back in front of the consonant and put the reph (&lt;code&gt;Z&lt;/code&gt;) after the cluster. If you need that direction, there is a free &lt;a href="https://krutidevtool.com/unicode-to-krutidev/" rel="noopener noreferrer"&gt;Unicode to Kruti Dev converter&lt;/a&gt; too. Both run entirely in the browser, so nothing is uploaded.&lt;/p&gt;

&lt;p&gt;The full key-by-key mapping table (vowels, consonants, conjuncts, matras, nukta and digits, with test samples) is open on GitHub under CC BY 4.0: &lt;a href="https://github.com/krutidevtool/krutidev-unicode-mapping" rel="noopener noreferrer"&gt;krutidev-unicode-mapping&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you spot a character that converts wrongly, open an issue there with the font version and the expected output.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>unicode</category>
    </item>
  </channel>
</rss>
