Convert between Roman, Unicode Devanagari, and Preeti font — instantly in your browser.
Free, no auth required. Works from any website, app, or script. Rate limit: 120 req/min per IP.
fetch() — works in all current browsers and Node.js 18+. No dependencies.
Basic usage
// Nepali Unicode Converter — https://pradipsubedi1.com.np/api/convert.php
async function nepaliConvert(action, text) {
const res = await fetch('https://pradipsubedi1.com.np/api/convert.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action, text })
});
if (!res.ok) throw new Error('HTTP ' + res.status);
const data = await res.json();
if (!data.success) throw new Error(data.error);
return data.result;
}
// ── Examples ──────────────────────────────────────────────
// Roman → Unicode
nepaliConvert('roman_to_unicode', 'namaste nepal')
.then(result => console.log(result)); // नमस्ते नेपाल
// Unicode → Roman
nepaliConvert('unicode_to_roman', 'हाम्रो घर')
.then(result => console.log(result)); // haamro ghar
// Preeti → Unicode
nepaliConvert('preeti_to_unicode', 'g]kfn')
.then(result => console.log(result)); // नेपाल
Live input field example
<textarea id="romanInput" placeholder="Type Roman..."></textarea>
<textarea id="unicodeOutput" placeholder="Unicode output..." readonly></textarea>
<script>
var timer;
document.getElementById('romanInput').addEventListener('input', function() {
clearTimeout(timer);
var text = this.value;
timer = setTimeout(function() {
fetch('https://pradipsubedi1.com.np/api/convert.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: 'roman_to_unicode', text: text })
})
.then(function(r) { return r.json(); })
.then(function(d) {
if (d.success) document.getElementById('unicodeOutput').value = d.result;
});
}, 300);
});
</script>
$.ajax() or $.post(). Requires jQuery 1.9+.
$.ajax (recommended)
function nepaliConvert(action, text, callback) {
$.ajax({
url: 'https://pradipsubedi1.com.np/api/convert.php',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ action: action, text: text }),
success: function(data) {
if (data.success) callback(null, data.result);
else callback(new Error(data.error));
},
error: function(xhr) {
callback(new Error('Request failed: ' + xhr.status));
}
});
}
// Usage
nepaliConvert('roman_to_unicode', 'hamro ghar', function(err, result) {
if (err) { console.error(err); return; }
$('#output').text(result); // हाम्रो घर
});
Live typing with jQuery
var cvtTimer;
$('#romanInput').on('input', function() {
var text = $(this).val();
clearTimeout(cvtTimer);
cvtTimer = setTimeout(function() {
$.ajax({
url: 'https://pradipsubedi1.com.np/api/convert.php',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ action: 'roman_to_unicode', text: text }),
success: function(d) { if (d.success) $('#unicodeOutput').val(d.result); }
});
}, 300);
});
curl or file_get_contents().
Useful for pre-processing content before saving to a database.
Using cURL (recommended)
<?php
function nepali_convert(string $action, string $text): string {
$url = 'https://pradipsubedi1.com.np/api/convert.php';
$payload = json_encode(['action' => $action, 'text' => $text]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $payload,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_TIMEOUT => 10,
]);
$body = curl_exec($ch);
$err = curl_error($ch);
curl_close($ch);
if ($err) throw new RuntimeException('cURL error: ' . $err);
$data = json_decode($body, true);
if (!$data['success']) throw new RuntimeException($data['error'] ?? 'Unknown error');
return $data['result'];
}
// ── Examples ──────────────────────────────────────────────
echo nepali_convert('roman_to_unicode', 'namaste nepal'); // नमस्ते नेपाल
echo nepali_convert('unicode_to_roman', 'हाम्रो घर'); // haamro ghar
echo nepali_convert('preeti_to_unicode', 'g]kfn'); // नेपाल
?>
Using file_get_contents (simpler, needs allow_url_fopen)
<?php
$payload = json_encode(['action' => 'roman_to_unicode', 'text' => 'hamro ghar']);
$opts = ['http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => $payload,
]];
$body = file_get_contents(
'https://pradipsubedi1.com.np/api/convert.php',
false,
stream_context_create($opts)
);
$data = json_decode($body, true);
echo $data['result']; // हाम्रो घर
?>
requests library. Works in scripts, Django, Flask, FastAPI — anywhere.
requests library
import requests
API_URL = "https://pradipsubedi1.com.np/api/convert.php"
def nepali_convert(action: str, text: str) -> str:
"""Convert Nepali text using the pradipsubedi1.com.np API."""
res = requests.post(API_URL, json={"action": action, "text": text}, timeout=10)
res.raise_for_status()
data = res.json()
if not data["success"]:
raise ValueError(data.get("error", "Conversion failed"))
return data["result"]
# ── Examples ──────────────────────────────────────────────
print(nepali_convert("roman_to_unicode", "namaste nepal")) # नमस्ते नेपाल
print(nepali_convert("unicode_to_roman", "हाम्रो घर")) # haamro ghar
print(nepali_convert("preeti_to_unicode", "g]kfn")) # नेपाल
print(nepali_convert("unicode_to_preeti", "नेपाल")) # g]kfn
Using urllib (no dependencies)
import urllib.request, json
def nepali_convert(action, text):
payload = json.dumps({"action": action, "text": text}).encode()
req = urllib.request.Request(
"https://pradipsubedi1.com.np/api/convert.php",
data=payload,
headers={"Content-Type": "application/json"},
method="POST"
)
with urllib.request.urlopen(req, timeout=10) as r:
data = json.loads(r.read())
return data["result"]
print(nepali_convert("roman_to_unicode", "hamro ghar")) # हाम्रो घर
<script> tag.
No iframe, no dependencies, fully styled, works with your existing page.
| Parameter | Type | Description |
|---|---|---|
action |
string · required |
roman_to_unicode ·
unicode_to_roman ·
preeti_to_unicode ·
unicode_to_preeti
|
text |
string | Input text to convert (max 50,000 chars) |
Success response
{ "success": true, "result": "नमस्ते नेपाल" }
Error response
{ "success": false, "error": "Unknown action: foo" }