• Post Reply Bookmark Topic Watch Topic
  • New Topic

UnsupportedEncodingException  RSS feed

 
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to use the encoding for EBCDIC:

http://download.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html
says this encoding is supported for version 6, and that "Cp1047" is the "canonical name"
for the encoding for the java.io and java.lang classes. What am I doing wrong?

rc
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, just above the entry for Cp1047 in the page you linked to it says this:
Extended Encoding Set (contained in lib/charsets.jar)

So perhaps that jar is missing, or needs to be in your classpath, or something like that?

Also I would suggest that using an OutputStreamWriter would be a more standard way of writing to EBCDIC than using getBytes():
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should have mentioned that I had tried adding the charsets.jar to my build path in eclipse. No change. It is also true that there is documentation saying that this encoding is included by at least Java 6, if not earlier, but I tried that anyway.

I tried your code for OutputStreamWriter. No change.

Anyone else have any ideas?

rc
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, evidently the code pages for these things are not standardized. I've got IBM's Rapid Application Development (RAD) installed, so I guess that means my code pages are IBM, not standard Java/Sun/Oracle. I used Charset.availableCharsets().keySet() to get and list the character sets I had, then scrounged around to find which one of them did EBCDIC, and found an "IBM500" that does. So now it is outputting the EBCDIC from that one, no problems.

So my question is now changed a bit. If I wanted to include the character set in my application so that it was insulated against attempting to run on a different JVM installation and not having the character set, how would I do that? Adding the "charsets.jar" to the build path doesn't seem to have done it.

rc
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Old thread, but there's an updated solution to the issue.

I ran across this problem as well and found that this was a Sun installer bug that didn't install the charset.jar file under Windows XP.

This was in JRE 6, but it may be with JRE's prior to 6 as well. It was reported to be fixed in JRE 7.

Apparently, even if you copy the file to the appropriate place and use the automated java update, it hunts it down and kills it (deletes it), so be aware.

I verified that the file installed correctly on my Windows 2003 Servers.

Once the file is placed there, you shouldn't have any more issues.




IBM500 Charsets:
[ibm-500, ebcdic-cp-bh, cp500, csIBM500, ibm500, ebcdic-cp-ch, 500]
Available Charsets:
[Big5, Big5-HKSCS, EUC-JP, EUC-KR, GB18030, GB2312, GBK, IBM-Thai, IBM00858, IBM01140, IBM01141, IBM01142, IBM01143, IBM01144, IBM01145, IBM01146, IBM01147, IBM01148, IBM01149, IBM037, IBM1026, IBM1047, IBM273, IBM277, IBM278, IBM280, IBM284, IBM285, IBM297, IBM420, IBM424, IBM437, IBM500, IBM775, IBM850, IBM852, IBM855, IBM857, IBM860, IBM861, IBM862, IBM863, IBM864, IBM865, IBM866, IBM868, IBM869, IBM870, IBM871, IBM918, ISO-2022-CN, ISO-2022-JP, ISO-2022-JP-2, ISO-2022-KR, ISO-8859-1, ISO-8859-13, ISO-8859-15, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, JIS_X0201, JIS_X0212-1990, KOI8-R, KOI8-U, Shift_JIS, TIS-620, US-ASCII, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF-8, windows-1250, windows-1251, windows-1252, windows-1253, windows-1254, windows-1255, windows-1256, windows-1257, windows-1258, windows-31j, x-Big5-HKSCS-2001, x-Big5-Solaris, x-euc-jp-linux, x-EUC-TW, x-eucJP-Open, x-IBM1006, x-IBM1025, x-IBM1046, x-IBM1097, x-IBM1098, x-IBM1112, x-IBM1122, x-IBM1123, x-IBM1124, x-IBM1381, x-IBM1383, x-IBM33722, x-IBM737, x-IBM833, x-IBM834, x-IBM856, x-IBM874, x-IBM875, x-IBM921, x-IBM922, x-IBM930, x-IBM933, x-IBM935, x-IBM937, x-IBM939, x-IBM942, x-IBM942C, x-IBM943, x-IBM943C, x-IBM948, x-IBM949, x-IBM949C, x-IBM950, x-IBM964, x-IBM970, x-ISCII91, x-ISO-2022-CN-CNS, x-ISO-2022-CN-GB, x-iso-8859-11, x-JIS0208, x-JISAutoDetect, x-Johab, x-MacArabic, x-MacCentralEurope, x-MacCroatian, x-MacCyrillic, x-MacDingbat, x-MacGreek, x-MacHebrew, x-MacIceland, x-MacRoman, x-MacRomania, x-MacSymbol, x-MacThai, x-MacTurkish, x-MacUkraine, x-MS932_0213, x-MS950-HKSCS, x-MS950-HKSCS-XP, x-mswin-936, x-PCK, x-SJIS_0213, x-UTF-16LE-BOM, X-UTF-32BE-BOM, X-UTF-32LE-BOM, x-windows-50220, x-windows-50221, x-windows-874, x-windows-949, x-windows-950, x-windows-iso2022jp]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!