Skip to content

Instantly share code, notes, and snippets.

@cesartalves
Created July 15, 2022 14:33
Show Gist options
  • Save cesartalves/800fbbbbe1b2b690a0e4c3586ac60f18 to your computer and use it in GitHub Desktop.
Save cesartalves/800fbbbbe1b2b690a0e4c3586ac60f18 to your computer and use it in GitHub Desktop.
Parse VNT Files Ruby
Dir.glob('*').each do |file|
content = File.read(file)
parsed_content = content.split("\n")[2].sub('BODY;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:', '')
.unpack('M').first.encode('utf-8', 'iso-8859-1')
IO.binwrite(file.gsub('vnt', 'txt'), parsed_content)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment