Re: How to detect 'bad' characters in expressions in the notebook?
- To: mathgroup at smc.vnet.net
- Subject: [mg113361] Re: How to detect 'bad' characters in expressions in the notebook?
- From: Joseph Gwinn <joegwinn at comcast.net>
- Date: Mon, 25 Oct 2010 06:41:08 -0400 (EDT)
- References: <ia10fv$otk$1@smc.vnet.net>
In article <ia10fv$otk$1 at smc.vnet.net>,
"Nasser M. Abbasi" <nma at 12000.org> wrote:
> 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.
Could be a while.
In the mean time, a faster approach would be to paste the quotation into
a text editor like UltraEdit32 (Windows) or BBEdit (Mac or Windows),
tell it to use the Latin 1 encodings only, and to zap gremlins, and then
copy the surviving text and paste it into Mathematica. This is
efficient for large amounts of text, but for a few lines manual retyping
is probably faster.
Joe Gwinn