all of a sudden error

All of a sudden I’m getting this error.
I have a basic statement and its paraphrase is:
intg = val(strg)

strg is “1”, so intg should be the number 1, but it’s now showing up as 0. It was reading correct about 2 hours ago.
I am on a Mac with 10.7 and xojo 2013r3.
Any thoughts about what’s going on?

Hi Arthur,

I just ran the following code on Windows and OSX and it works. (Xojo 2013 r3.2, Windows 8.1, Mac Mini Maverick)

dim i as integer dim s as string s = "1" i = val(s) MsgBox CStr(i)

Is it possible that the string may have a different character other than a one (1) or zero(0), such as possibly the letter o, or the letter L?

or does it contain a leading (non-space) non-printable character?

I had some issues recently with the encodings of some strings. The encoding wasn’t what I was expecting and when I was doing some string comparisons, I was getting results that made no sense. Turned out one string was UTF-8 and the other was ASCII.

It is since it hasn’t removed the UTF BOM. That was the extra stuff that caused it to be 0.
I had a file with a BOM and that was supposed to be removed.
It split into an array correctly, but the BOM is still there when I copy to a string.
Sorry thought my code was right.