A TypeScript/JavaScript library for bidirectional conversion between Latin text and Old Hungarian script (Székely rovásírás), achieved using Unicode characters. Supports the complete Hungarian alphabet, numbers, and alternative character variants.
Old Hungarian script (Székely-Hungarian rovás, Hungarian: 𐲥𐳋𐳓𐳉𐳗-𐳘𐳀𐳍𐳀𐳢 𐳢𐳛𐳮𐳁𐳤) is a historical writing system used by Hungarians before the adoption of the Latin alphabet. It's still used today for decorative and cultural purposes, particularly in the Székely Land region of Romania.
Visit the live demo at: https://MicroKiss.github.io/old-hungarian/
- Bidirectional conversion between Latin and Old Hungarian script
- Convert Latin text to Old Hungarian script
- Convert Old Hungarian script back to Latin text
- Support for all Hungarian letters including digraphs (cs, gy, ly, ny, sz, ty, zs)
- Number conversion with additive and multiplicative formats
- Alternative character variants for 'k' and 'ö'
- Validation and error handling for illegal characters
- Zero dependencies
npm install old-hungarianimport { toOldHungarian, fromOldHungarian } from 'old-hungarian';
// Convert to Old Hungarian
toOldHungarian('Szia');
// '𐲥𐳐𐳀'
toOldHungarian('Magyarország');
// '𐲘𐳀𐳎𐳀𐳢𐳛𐳢𐳥𐳁𐳍'
// Convert from Old Hungarian
fromOldHungarian('𐲥𐳐𐳀');
// 'Szia'
fromOldHungarian('𐲘𐳀𐳎𐳀𐳢𐳛𐳢𐳥𐳁𐳍');
// 'Magyarország'
// With options
toOldHungarian('kör 456', {
alternativeK: true,
alternativeO: true,
numberFormat: 'additive'
});
// '𐳔𐳞𐳢 𐳾𐳾𐳾𐳾𐳽𐳻𐳺'
fromOldHungarian('𐳔𐳞𐳢 𐳾𐳾𐳾𐳾𐳽𐳻𐳺', {
numberFormat: 'additive'
});
// 'kör 456'Important: Old Hungarian script uses Unicode characters from the range U+10C80 to U+10CFF. To properly display these characters:
- Ensure your system/application uses UTF-8 encoding
- Use a font that supports Old Hungarian characters (e.g., Noto Sans Old Hungarian, Segoe UI Historic)
- For web applications, add
<meta charset="UTF-8">to your HTML- Some environments may show boxes (□) if the font doesn't support these characters
See the Unicode Standard - Old Hungarian for more information.
import {
toOldHungarian,
fromOldHungarian,
validateLatinInput,
validateOldHungarianInput,
IllegalCharacterError
} from 'old-hungarian';
// Basic conversion to Old Hungarian
const result = toOldHungarian('hello');
// '𐳏𐳉𐳖𐳖𐳛'
// Basic conversion from Old Hungarian
const original = fromOldHungarian('𐳏𐳉𐳖𐳖𐳛');
// 'hello'
// Validation before conversion (Latin)
if (validateLatinInput('Szia')) {
const converted = toOldHungarian('Szia');
}
// Validation before conversion (Old Hungarian)
if (validateOldHungarianInput('𐲥𐳐𐳀')) {
const converted = fromOldHungarian('𐲥𐳐𐳀');
}
// Error handling
try {
toOldHungarian('Hello 世界', { strict: true });
} catch (error) {
if (error instanceof IllegalCharacterError) {
console.log(`Illegal character '${error.illegalCharacter}' at position ${error.position}`);
}
}- API Reference - Complete API documentation with all functions, options, types, and examples
- Character Mappings - Full reference of Latin to Old Hungarian character mappings
toOldHungarian(text, options?)- Convert Latin text to Old Hungarian scriptfromOldHungarian(text, options?)- Convert Old Hungarian script to Latin textvalidateLatinInput(text)- Check if text contains only legal Latin charactersfindIllegalLatinCharacter(text)- Find first illegal Latin character and its positionvalidateOldHungarianInput(text)- Check if text contains only legal Old Hungarian charactersfindIllegalOldHungarianCharacter(text)- Find first illegal Old Hungarian character and its positionIllegalCharacterError- Custom error class for illegal charactersoldHungarianCharacters- Array of character mappingsoldHungarianNumbers- Array of number mappings
MIT
János Kiss dinnyetok@gmail.com