indic-transliteration / sanscript.js

Transliteration package for Indian scripts
MIT License
98 stars 39 forks source link

node js: not showing the correct output #23

Open sant527 opened 4 years ago

sant527 commented 4 years ago

I have to exectue javascript from linux bash shell. So i have decided to use node

I have downloaded a js file from https://raw.githubusercontent.com/sanskrit/sanscript.js/master/src/sanscript.js as sanskrit.js

Below is my js file to be run using node:

latin_to_devnagari.js

var sanskrit = require("./sanscript.js");

console.log(sanskrit.t("śrotram cakṣuḥ sparśanam ca", 'iast', 'devanagari'))

I run this using

node latin_to_devnagari.js

It shows

श्रोत्रम् चक्ष

instead of श्रोत्रम् चक्षुः स्पर्शनम् च

Where as when i try this in browser

<!DOCTYPE html>
<html>
    <head>
    <script src="sanscript.js"></script>
    <script>
      console.log(Sanscript.t("śrotram cakṣuḥ sparśanam ca", 'iast', 'devanagari'))
    </script>
    </head>

    <body>
        Testing
    </body>
</html>

and open this file in a browser then in the browser console i see

श्रोत्रम् चक्षुः स्पर्शनम् च

So how to show the correct output using node.

joshita01 commented 1 year ago

facing the same issue someone please help