Created
July 15, 2022 14:33
-
-
Save cesartalves/800fbbbbe1b2b690a0e4c3586ac60f18 to your computer and use it in GitHub Desktop.
Parse VNT Files Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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