Aug. 31st, 2019

victor_sudakov: (Default)
Изначально мои репозитории с текстами создавались ещё в CVS и в кодировке KOI8-R. Потом были экспортированы в SVN и Mercurial, но кодировка текстов осталась KOI8-R.

Появилось желание перекодировать тексты в Unicode, вместе с их историей, как будто они изначально были в Unicode. В рассылке mercurial@mercurial-scm.org Steve Fink дал мне расширение к расширению convert, которое это позволяет.
No promises, but you could give this a try: https://hg.sr.ht/~sfink/cmdconvert

Clone it to somewhere like ~/lib/hg. Add

    [extensions]
    cmdconvert = ~/lib/hg/cmdconvert

to your ~/.hgrc (or hgrc.ini or whatever it is on Windows.)

Then try running

    hg convert --command 'iconv -f KOI8-R -t UTF-8' your_repo new_repo

Odds of it working on the first try are somewhat low (I don't really know what
I'm doing.)

If you want to restrict by file extension, do something like

    hg convert --ext .txt --ext .html --command 'iconv -f KOI8-R -t UTF-8' your_repo
new_repo

It's not going to be fast, either.

Сработало прекрасно.

Profile

victor_sudakov: (Default)
Виктор Судаков

December 2024

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 9th, 2025 06:51 pm
Powered by Dreamwidth Studios