Last active
March 9, 2016 09:31
-
-
Save Szeliga/e19b9d329119032586ca to your computer and use it in GitHub Desktop.
Parsing UTF-16LE CSV file
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
# Open your terminal, navigate to the folder were the book.csv file is residing | |
# and type irb, when the interactive ruby console launches, type in the following | |
# it will print first 5 ISBN-13 numbers | |
require 'csv' | |
i = 0; CSV.foreach('book.csv', headers: :first_row, encoding: 'UTF-16LE:UTF-8') { |line| break if i == 5; puts line['isbn13']; i += 1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment