How to detect 'bad' characters in expressions in the notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg113346] How to detect 'bad' characters in expressions in the notebook?
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Sun, 24 Oct 2010 06:07:00 -0400 (EDT)
- Reply-to: nma at 12000.org
Experts;
I copied a Mathematica expression from a PDF file to a Mathematica
notebook (by using the mouse, selected the expressions and pasted it
into a new cell in the notebook).
The expression looked fine, nothing that I can see wrong with it. But
when I execute it, Mathematica complained with an error message that did
not make any sense given what I have on the screen.
I knew that there was some problem with the copy, because when I typed
the same exact command below it, it worked with no errors.
But looking at the screen, both what I copied and what I typed, are
exactly the same. Absolutely exactly the same expressions looked the
same on the screen as you can see yourself by looking at the screen
shot, link below.
But when I converted the commands to inputForm to compare the copied
command with the I typed, I saw the difference.
In the PDF copied command, it had
PlotRange->{}
The arrow was the problem.
For some reason, it remained of some encoding which did not match
Mathematica's own -> that one enters by typing dash followed by > which
then Mathematica converts automatically to a nice solid one glyph ->.
Here is an image showing the problem
http://12000.org/tmp/hidden_stuff/image.png
And here is the notebook
http://12000.org/tmp/hidden_stuff/hidden.nb
So, my question: was there a way I could have asked Mathematica to
highlight such characters as being ones which it did not recognize?
This would have saved much time.
I have had such problems before, where what I look at in the notebook,
is not what I think it is. The above is an example.
I guess my lesson for today: next time I copy something from a PDF file
or other source to the notebook, I better examine each character in
inputForm before using it even if it did look OK on the screen.
Sounds like so much fun.
--Nasser