siberia-man has asked for the wisdom of the Perl Monks concerning the following question:
Hello dear Monks,
I came with the issue I have encountered recently.
I have the perl script git-md-toc helping me to generate Table of Content (TOC) from a markdown file and embed it into the original file.
It worked fine with the Latin charset. Later I found it doesn't work with other encodings. I extedned it to support other encodings by specifying a particular encoding via an additional command line option. It works fine as well (I tested it under Cygwin). However it fails under DOS session, if there is need to add a title of TOC to the file written with non-Latin charset/encoding.
For example, there is test file in UTF8 having some Cyrillic text. I need to update it adding TOC with the title in Russian.
This command in bash works fine (Perl 5.30 shipped with Cygwin):
git-md-toc -ut "some-text-in-russian" -Tutf8 "utf8-cyrillic.md"
But it fails in DOS sessions -- the title is being added in wrong encoding. To resolve the issue I have to use one more option (standalone StrawberryPerl 5.30):
git-md-toc --title-transcode=cp1251 -ut "some-text-in-russian" -Tutf8 +"utf8-cyrillic.md"
The thing confusing me is that the default DOS code page is 866 and the encoding for the title I have to specified is 1251.
My questions are:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl, DOS and encodings
by haj (Vicar) on Apr 29, 2020 at 19:37 UTC | |
by siberia-man (Friar) on Apr 29, 2020 at 20:02 UTC | |
by haj (Vicar) on Apr 29, 2020 at 22:10 UTC | |
by siberia-man (Friar) on Apr 30, 2020 at 07:24 UTC | |
|
Re: Perl, DOS and encodings
by Anonymous Monk on Apr 29, 2020 at 23:43 UTC | |
by siberia-man (Friar) on Apr 30, 2020 at 07:28 UTC |