Hi,
I don't know much about unicodedata, I am confused, why doesn't cp437 contain a reference to 'GREEK SMALL LETTER MU'?
Even though it is unlikely that I will get this to work, I was trying to find a path to printing a "mu" character on an output image using writeImage. Even though it is possible to annotate with greek characters using annotate (µ), there were some problems getting annotate to plot consistently in a script. Therefore, writeImage is being used. Even if annotate was working consistently, writeImage would be needed to plot text because the final display will be rotated.
Joleen
unicodedata cp437
Re: unicodedata cp437
Hi joleen
Sometime back I wrote hindi string on indian satellite data.
Will that be of any help to you?
Regards
Ghansham
Sometime back I wrote hindi string on indian satellite data.
Will that be of any help to you?
Regards
Ghansham
Re: unicodedata cp437
Ghansham,
It might, I may encounter other problems with writeImage, but it would help to have a working example. I am not sure if I am using the code tables correctly. Specifically for 'GREEK SMALL LETTER MU', I get the following results...
returns
ascii
iso8859-7: Ï
mac-greek: Ì
cp437: Traceback (most recent call last):
File "", line 14, in
File "/Users/joleenf/Documents/McIDAS-V/jython2.5.2/Lib/encodings/cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u03bc' in position 0: character maps to <undefined>
I probably should not be changing the default encoding, but I could not figure out why I could not get this to work. After I have a solution to getting a greek symbol, it still might be difficult to pass that to writeImage, I am not sure how information gets interpreted through that function.
Joleen
It might, I may encounter other problems with writeImage, but it would help to have a working example. I am not sure if I am using the code tables correctly. Specifically for 'GREEK SMALL LETTER MU', I get the following results...
Code: Select all
import unicodedata as ud
import sys
print sys.getdefaultencoding()
sys.setdefaultencoding('iso8859-7')
print 'iso8859-7: ',ud.lookup('GREEK SMALL LETTER MU')
sys.setdefaultencoding('mac-greek')
print 'mac-greek: ', ud.lookup('GREEK SMALL LETTER MU')
sys.setdefaultencoding('cp437')
print 'cp437: ', ud.lookup('GREEK SMALL LETTER MU')
returns
ascii
iso8859-7: Ï
mac-greek: Ì
cp437: Traceback (most recent call last):
File "", line 14, in
File "/Users/joleenf/Documents/McIDAS-V/jython2.5.2/Lib/encodings/cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u03bc' in position 0: character maps to <undefined>
I probably should not be changing the default encoding, but I could not figure out why I could not get this to work. After I have a solution to getting a greek symbol, it still might be difficult to pass that to writeImage, I am not sure how information gets interpreted through that function.
Joleen
Re: unicodedata cp437
The issue is that the XML parsing being used by "writeImage()" needs to explicitly request UTF-8 encoding and not whatever the default is. We have verified this on Windows and OS-X.
I have submitted the change to Unidata.
I have submitted the change to Unidata.
Re: unicodedata cp437
Once this change is incorporated, it should be possible to insert the symbol directly in the writeImage command...
writeImage("/temp/idvimg.png", "overlay text=11.7 µm anchor=UM place=UM,0,70 color=green fontsize=32 fontface=Arial")
On a mac that is "alt-m", on window, the micro entity can be selected.
Joleen
writeImage("/temp/idvimg.png", "overlay text=11.7 µm anchor=UM place=UM,0,70 color=green fontsize=32 fontface=Arial")
On a mac that is "alt-m", on window, the micro entity can be selected.
Joleen
Re: unicodedata cp437
I think it is possible without that. What I did was last time
as far as I remember was inserted the unicode string in a properties file and used filereader constructor of java.util.properties to read that string in java and it worked. I didnt get time to send you a demo.
Will try to send a sample script.
Ghansham
as far as I remember was inserted the unicode string in a properties file and used filereader constructor of java.util.properties to read that string in java and it worked. I didnt get time to send you a demo.
Will try to send a sample script.
Ghansham
Re: unicodedata cp437
Thanks Ghansham, when you have the time, I still would be really interested in seeing that script.
Joleen
Joleen
Re: unicodedata cp437
Hi Bob,
It looks like
http://mcidas.ssec.wisc.edu/inquiry-v/?inquiry=1832
Is still an issue....I have tried various combinations for getting the proper encoding through the writeImage formatting, and still can't get a proper symbol.
p=buildWindow()[0]
p.captureImage('test.png', formatting=[TextOverlay(text='amp \\\u00fb \u00fb µm', place='MM,0,0', anchor='MM', color='yellow')])
I have posted to the IDV user group as well to find out if any IDV users found a work around, but have received no responses so far.
Thanks,
Joleen
It looks like
http://mcidas.ssec.wisc.edu/inquiry-v/?inquiry=1832
Is still an issue....I have tried various combinations for getting the proper encoding through the writeImage formatting, and still can't get a proper symbol.
p=buildWindow()[0]
p.captureImage('test.png', formatting=[TextOverlay(text='amp \\\u00fb \u00fb µm', place='MM,0,0', anchor='MM', color='yellow')])
I have posted to the IDV user group as well to find out if any IDV users found a work around, but have received no responses so far.
Thanks,
Joleen
Re: unicodedata cp437
Hi Joleen -
You're correct that this is still an issue. I spent some time trying to find a workaround, but I was unsuccessful. I added a note to Inquiry 1832 that you came across the problem again. Please let us know if you hear anything back from the IDV user's list or if you are able to find a workaround yourself.
Thanks -
Bob
You're correct that this is still an issue. I spent some time trying to find a workaround, but I was unsuccessful. I added a note to Inquiry 1832 that you came across the problem again. Please let us know if you hear anything back from the IDV user's list or if you are able to find a workaround yourself.
Thanks -
Bob