Skip to content

Instantly share code, notes, and snippets.

View rjhancock's full-sized avatar
🏠
Working from home

Richard J Hancock rjhancock

🏠
Working from home
View GitHub Profile
@rjhancock
rjhancock / line_endings_and_encoding_enforcement.rb
Created October 6, 2020 13:56
Convert CRLF -> LF and Enforce UTF-8 File Format
files = Dir['**/*.blk']
files += Dir['**/*.mtf']
files.each do |file|
puts "Checking file: #{file}"
raw = File.read(file)
# New Line Conversion from CRLF -> LF
data = raw.encode(raw.encoding, universal_newline: true)