Hello,
I have experienced a problem when reading a CSV-like text file. The file contains some values with Slovak characters, I am using the Windows-1250 encoding for both the script and the input file. The structure of a line from this file looks like:
data1 ;data2 ;data3;...;datan;
I am iterating over the file using the fgetcsv() function, which saves the values from a row into an array. Then I extract some of the values I need for further processing like this:
$sutaz = trim($dvojica[1], " ");
- the columns have fixed width, so i need to trim() the spaces. When I print the values into the basic output (echo, just for testing purposes) everything is working fine, the characters with diacritics are shown correctly, but with a small exception - if a value (especially a surname) begins with a capital letter with diacritics (mostly Š or Ž), the first letter is simply not shown - the surname is printed as "vec" instead of "Švec". After reading a lot of posts I am still not sure if a string can begin with such a special character, or how to solve this problem.
Thanks in advance and sorry for my English 🙂