Re: Macro language and non-ASCII characters

Posted by Michael Doube-4 on
URL: http://imagej.273.s1.nabble.com/Macro-language-and-non-ASCII-characters-tp5002388p5002424.html

Hi Michael

(adding to the large and growing tally of beers I owe you)
apologies in advance for lame Outlook web client not understanding quoting in replies.

-----------------------
no such problem on Mac OS X or Wine (emulated Windows on OS X):

setResult("with space", 0, 1);
setResult("Vol. (µm³)", 0, 2);
getResult("with space", 0); //gives 1 in the Log window
getResult("Vol. (µm³)", 0); //gives 2
----------------------------

Works here too, run as a macro on Ubuntu. Which makes me wonder what is happening with the code. Changing ³ to ^3 in the Java source fixed it for my user, and I'm pretty sure I'm using micron and not Greek mu.

----------------
Note, however, that spaces or tabs should be avoided in column names - there are cases where spaces or tabs cause a problem
--------------

Yeah, I remember that one for GenericDialog menu items too.

-------------
If you have a macro file, make sure that file.encoding in Plugins>Utilities>ImageJ Properties matches the encoding of the file (does ImageJ display the macro correctly when opened in a text window?).

 To avoid file encoding problems, usually it is best to use only ascii characters in macros and Java sourcecode. Instead of the special characters, use the fromCharCode macro function:

muChar = fromCharCode(0xb5);
cubeChar = fromCharCode(0xb3);
getResult("Vol. ("+ muChar +"m"+ cubeChar +")", 0);

------------------

Good hints, I will pass them on.

Michael
[http://www.rvc.ac.uk/cf_images/button_rvc.png]<http://www.rvc.ac.uk>    [http://www.rvc.ac.uk/cf_images/button_twitter.png] <http://twitter.com/RoyalVetCollege>     [http://www.rvc.ac.uk/cf_images/button_facebook.png] <http://www.facebook.com/theRVC>

This message, together with any attachments, is intended for the stated addressee(s) only and may contain privileged or confidential information. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Royal Veterinary College (RVC). If you are not the intended recipient, please notify the sender and be advised that you have received this message in error and that any use, dissemination, forwarding, printing, or copying is strictly prohibited. Unless stated expressly in this email, this email does not create, form part of, or vary any contractual or unilateral obligation. Email communication cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, amended, lost, destroyed, incomplete or contain viruses. Therefore, we do not accept liability for any such matters or their consequences. Communication with us by email will be taken as acceptance of the risks inherent in doing so.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html