• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Here's a weird one (debugging invisible characters?)

Anybody seen this one before?
I was getting a "T_String found, expecting T_Function" error in the middle of declaring some vars at the beginning of my model. There was nothing wrong with the line in question, but I finally figured it out by going into BBEdit and turning on "invisible" characters. Here's what I saw:

Did a BBEdit search and replace to get rid of the weird characters and replace with tabs and now it works. Anybody have any idea what they are or how they got there? I copied and pasted the model code from a tutorial web page so figure I picked up the weird characters there somehow. Image of the invisibles here:


I'm going to paste the characters in code to see if they show up here:
Edit: They don't show up, but if you drag your cursor you can select them.

Lesson learned: don't forget to turn on invisibles to diagnose hidden problems!

Humm, i've been there before, some website have bad char type etc. etc.

Good to have editor help there realy.

I just replicated the problem when copying and pasting some code from the online User Guide. I'm assuming this might be fairly standard procedure for people to do and it might be good to know that doing that could cause problems (for some reason).

I'm on a MacBook Pro and I'm running the Entropy PHP 5 for Tiger modified to run on Leopard with Apache2 (via some good instructions in the Entropy forum). I need to test if it happens in more than one browser, but I copied and pasted some code from my CI installations User Guide into a BBEdit document and then turned invisibles on. The problem was there and it will generate a T_ error of some kind when it hits that line.

Replacing the characters with normal spaces or tabs fixes the problem. I'll link to another screenshot of the BBEdit showing invisibles in the morning.

The invisible character is a "non-breaking space". Also known as:
You can get one for yourself when typing Option-Space in BBEdit. And the User Guide is indeed full of them. Like you say, just turn on invisibles and run a Search and Replace if you copy and paste code.

Why don't they use the <pre> tag for code instead of nbsp; ?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.