Skip to content

Instantly share code, notes, and snippets.

@patte
Created October 8, 2018 14:05
Show Gist options
  • Save patte/22f04bd9b4ec688a6a4183811ddbd28c to your computer and use it in GitHub Desktop.
Save patte/22f04bd9b4ec688a6a4183811ddbd28c to your computer and use it in GitHub Desktop.
fix UTF8 combining diaeresis
//https://www.fileformat.info/info/unicode/char/0308/index.htm
//https://vi.stackexchange.com/questions/3557/can-i-search-for-a-unicode-combining-character-in-vim
const fs = require('fs')
const path = __dirname+'/article.md'
const buffer = fs.readFileSync(path)
const fixed = buffer.toString('utf8')
.replace(/a\u0308/g, 'ä')
.replace(/u\u0308/g, 'ü')
.replace(/o\u0308/g, 'ö')
fs.writeFileSync(path+'-new', fixed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment