'string length display one character extra - ruby

I am processing a csv file uploaded by users, the csv only has one column with the header row "API"

when i process the CSV, for one of the file i see that

"API".downcase.length displays 4

could it be a encoding issue. when i do header[0].downcase.bytes for the string i see

[239, 187, 191, 97, 112, 105]

when i do "api".bytes i see

[97, 112, 105]

Any help in understanding why "API".downcase.length in above example display 4 would be really great.

I parse the file like

       CSV.foreach(@file_path, headers: true) do |row|
  

Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source