Skip to content

About

Convert legacy Bijoy / Sutonny MJ Bangla text and Word documents (.docx, .odt, .rtf, .html, .txt) to Unicode Bengali. TypeScript library (npm: bijoy2unicode) plus a browser app. Strict font-aware detection leaves English alone. MIT.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

78 Commits

Folders and files

Repository files navigation

bijoy2unicode

bijoy2unicode

Convert legacy Bijoy / Sutonny MJ Bangla text and Word documents to Unicode Bengali.

npm version npm downloads per month npm downloads per week GitHub stars License: MIT Live demo

If this converted a document you actually needed, please star this repo — it is the main way other people find the tool. Issues and awkward Bijoy .docx samples are also welcome.

Try it

Drag-and-drop a .docx, .odt, .rtf, .html, or .txt file. Those formats are converted in the browser; they are not uploaded to a bijoy2unicode server.

Legacy binary .doc is different: the npm package does not read .doc. In the web app, if you add your own CloudConvert API token in Settings, the file is sent from the browser to CloudConvert to be upgraded to .docx, then the Bijoy → Unicode pass still runs locally. Without a token, the app falls back to an in-browser text-only .doc path that does not keep complex formatting. The app’s FAQ notes that CloudConvert’s free plan (as documented there) covers 25 conversions per day.

What’s in this monorepo

Folder Description
packages/bijoy2unicode The npm package — string + file conversion. ESM + CJS + TypeScript types. Node 18+.
bijoy2unicode-app The live web app — Next.js, drag-and-drop UI, optional CloudConvert BYOK for .doc.
testfiles Real-world .docx regression samples.

The published package is bijoy2unicode (currently 1.0.2). Full API notes live in packages/bijoy2unicode/README.md.

Install

npm install bijoy2unicode

Requires Node.js 18 or later. The default entry has no file I/O. Import bijoy2unicode/docx when you need documents (that path uses JSZip).

Usage

import { convertBijoyToUnicode } from "bijoy2unicode";
import { convertDocx, convertFile } from "bijoy2unicode/docx";

convertBijoyToUnicode("Avgvi †mvbvi evsjv");
// → "আমার সোনার বাংলা"

const blob = await convertDocx(file);
const result = await convertFile(file);
// result.blob, result.filename

Helpers on the default entry: looksLikeBijoy, hasBengaliUnicode, shouldConvertAsBijoy, scanUnmapped, isSuspiciousLeftover, describeCodepoint.

File helpers: convertDocx, convertOdt, convertRtf, convertHtml (browser DOMParser only), convertTxt, convertFile. Pass { force: true } to convert even when heuristics are unsure. { onProgress } reports stage and percent.

How font-aware detection works

.docx conversion does not run the converter on every run blindly. It resolves the effective font of each <w:r> in this order:

  1. The run’s own <w:rFonts>
  2. The run’s character style
  3. The paragraph run fonts
  4. The paragraph style (basedOn chain)
  5. Document default <w:rPrDefault>

Known Bijoy fonts (for example names ending in MJ, BijoyEkattor, Sulekha, Boishakhi) are converted. Known Unicode Bangla fonts (Nikosh, SolaimanLipi, Vrinda, Noto Bengali, and similar) are left alone. Ambiguous runs use character heuristics (high-byte characters, Bijoy bigram density, English-word lookup, vowel ratio).

English in Calibri / Times New Roman / Arial stays untouched, even inside a Bijoy-heavy document.

Supported Bijoy details (from the package)

These are cases the library is written to handle, including some encodings other converters miss:

  • Trailing-© reph reorder (Kg©KZ©vi → কর্মকর্তার)
  • Í (U+00CD) prefix-pair conjuncts (we¯ÍvwiZ → বিস্তারিত)
  • iæ → রু ordered before bare æ → ু
  • ÿ → ক্ষ alternate encoding
  • Precomposed nukta letters (ড় / ঢ় / য়) kept as Word/Office usually stores them
  • Multi-character sequences such as Mø → গ্ল, cø → প্ল, eø → ব্ল, kø → শ্ল

Limitations

  • Legacy .doc (binary OLE) is not supported in the npm package. Convert to .docx first (LibreOffice, or CloudConvert as in the web app).
  • .html conversion needs DOMParser (browser). On a server, extract text and use convertBijoyToUnicode.
  • Pure-ASCII Bijoy (bvg wcZvi bvg with no high-byte characters) is ambiguous in .txt / .rtf. Use force: true if you know it is Bijoy.

Development

cd bijoy2unicode-app
npm run dev

Open http://localhost:3000. Package tests and the publish workflow live under packages/bijoy2unicode.

Contributing

Bug reports and PR with messy real-world Bijoy .docx samples help the most. The live app can report leftover unmapped characters.

Author

Md. Jehad (Jehadur Rahman Emran) · Cloud Connect AI

The TypeScript implementation builds on, and corrects, earlier open-source Bijoy converters that served as inspiration. See the package README for that note.

Snippets & recipes

License

MIT

About

Convert legacy Bijoy / Sutonny MJ Bangla text and Word documents (.docx, .odt, .rtf, .html, .txt) to Unicode Bengali. TypeScript library (npm: bijoy2unicode) plus a browser app. Strict font-aware detection leaves English alone. MIT.

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages