I'm not sure if this is an encoding issue or not, but for some reason strlen is not giving me the correct length of a string stored in a mysql database.
I have two strings, one containing letters and spaces, and another containing letters, spaces and underscores.
Even if both strings are exactly the same length, the reported length given by strlen is incorrect.
For testing I used these two strings:
This is a long Phrase
and blanked out some of the letters with underscores to get:
As far as I can tell, they are the same length, however, strlen will report the first phrase as having a length of 21, and the second as having a length of 25.
Now, there are 4 spaces in the second phrase, and this coincidentally how far off the length is...
Any thoughts?
Ray
I have two strings, one containing letters and spaces, and another containing letters, spaces and underscores.
Even if both strings are exactly the same length, the reported length given by strlen is incorrect.
For testing I used these two strings:
This is a long Phrase
and blanked out some of the letters with underscores to get:
Code:
___s __ _ ____ ______
Now, there are 4 spaces in the second phrase, and this coincidentally how far off the length is...
Any thoughts?
Ray
Comment