Trouble with reading first line of a file
Hi,
I had a trouble with reading the first line of a file, or to be more accurate, I found that the first character of the file is not something that appears on the actual file, for example: my file looks like this: PHP Code:
https://i.imgur.com/EPuJ02j.png This causing me troubles when I'm trying to compare the SongName with a client input.. so here's my code: PHP Code:
Thanks in advance. |
Re: Trouble with reading first line of a file
Set file reading flags to "rt" read text probably it's reading binaries
|
Re: Trouble with reading first line of a file
Quote:
EDIT: If I'm adding an empty line in head of the file, like this: PHP Code:
it's looks like something in the head of the file is including something i can't read. |
Re: Trouble with reading first line of a file
Quote:
|
Re: Trouble with reading first line of a file
Don't do this:
Code:
replace(text, charsmax(text), "^n", "");Code:
trim(text) |
Re: Trouble with reading first line of a file
Quote:
Quote:
I did managed to find the solution, to solve this issue I made 3 changes: 1. I changed the the read text property from "r" to "rt" 2. I removed the quotes from the line that I was read, by remove_all function. 3. MOST IMPORTANT: I created a brand new file encoded with ANSI (the old one was encoded by UTF-8, wich may explain why i wasn't been able to print the first character correctly). I guess this issue was related to UTF-8 compatibility, Anyway, thanks again for you all! |
| All times are GMT -4. The time now is 17:22. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.