From 786087299349f54257ede837bd37b2c144a85245 Mon Sep 17 00:00:00 2001 From: Rainer Klute Date: Sat, 23 Apr 2005 14:17:07 +0000 Subject: [PATCH] - Added a couple of Macintosh codepage numbers to Java encoding names. Thanks to Ralf Terdic for providing them! However, please note that neither Ralf nor I were able to test all those mappings. So please post a bug if you encounter any problems! git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353650 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/hpsf/Constants.java | 56 ++++++++++++++++++- .../org/apache/poi/hpsf/VariantSupport.java | 32 ++++++++++- 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/poi/hpsf/Constants.java b/src/java/org/apache/poi/hpsf/Constants.java index e5656ae3d8..b5d4d3e8c4 100644 --- a/src/java/org/apache/poi/hpsf/Constants.java +++ b/src/java/org/apache/poi/hpsf/Constants.java @@ -11,15 +11,65 @@ package org.apache.poi.hpsf; public class Constants { - /**

Codepage for Macintosh Roman (MacRoman)

*/ - public static final int CP_MACROMAN = 10000; - /**

Codepage for SJIS

*/ public static final int CP_SJIS = 932; /**

Codepage for UTF-16

*/ public static final int CP_UTF16 = 1200; + /**

Codepage for Macintosh Roman (Java: MacRoman)

*/ + public static final int CP_MAC_ROMAN = 10000; + + /**

Codepage for Macintosh Japan (Java: unknown - use SJIS, cp942 or + * cp943)

*/ + public static final int CP_MAC_JAPAN = 10001; + + /**

Codepage for Macintosh Chinese Traditional (Java: unknown - use Big5, + * MS950, or cp937)

*/ + public static final int CP_MAC_CHINESE_TRADITIONAL = 10002; + + /**

Codepage for Macintosh Korean (Java: unknown - use EUC_KR or + * cp949)

*/ + public static final int CP_MAC_KOREAN = 10003; + + /**

Codepage for Macintosh Arabic (Java: MacArabic)

*/ + public static final int CP_MAC_ARABIC = 10004; + + /**

Codepage for Macintosh Hebrew (Java: MacHebrew)

*/ + public static final int CP_MAC_HEBREW = 10005; + + /**

Codepage for Macintosh Greek (Java: MacGreek)

*/ + public static final int CP_MAC_GREEK = 10006; + + /**

Codepage for Macintosh Cyrillic (Java: MacCyrillic)

*/ + public static final int CP_MAC_CYRILLIC = 10007; + + /**

Codepage for Macintosh Chinese Simplified (Java: unknown - use + * EUC_CN, ISO2022_CN_GB, MS936 or cp935)

*/ + public static final int CP_MAC_CHINESE_SIMPLE = 10008; + + /**

Codepage for Macintosh Romanian (Java: MacRomania)

*/ + public static final int CP_MAC_ROMANIA = 10010; + + /**

Codepage for Macintosh Ukrainian (Java: MacUkraine)

*/ + public static final int CP_MAC_UKRAINE = 10017; + + /**

Codepage for Macintosh Thai (Java: MacThai)

*/ + public static final int CP_MAC_THAI = 10021; + + /**

Codepage for Macintosh Central Europe (Latin-2) + * (Java: MacCentralEurope)

*/ + public static final int CP_MAC_CENTRAL_EUROPE = 10029; + + /**

Codepage for Macintosh Iceland (Java: MacIceland)

*/ + public static final int CP_MAC_ICELAND = 10079; + + /**

Codepage for Macintosh Turkish (Java: MacTurkish)

*/ + public static final int CP_MAC_TURKISH = 10081; + + /**

Codepage for Macintosh Croatian (Java: MacCroatian)

*/ + public static final int CP_MAC_CROATIAN = 10082; + /**

Codepage for UTF-8

*/ public static final int CP_UTF8 = 65001; diff --git a/src/java/org/apache/poi/hpsf/VariantSupport.java b/src/java/org/apache/poi/hpsf/VariantSupport.java index b9ab14ffca..ebb2c3722e 100644 --- a/src/java/org/apache/poi/hpsf/VariantSupport.java +++ b/src/java/org/apache/poi/hpsf/VariantSupport.java @@ -294,8 +294,38 @@ public class VariantSupport extends Variant ("Codepage number may not be " + codepage); switch (codepage) { - case Constants.CP_MACROMAN: + case Constants.CP_MAC_ROMAN: return "MacRoman"; + case Constants.CP_MAC_JAPAN: + return "SJIS"; + case Constants.CP_MAC_CHINESE_TRADITIONAL: + return "Big5"; + case Constants.CP_MAC_KOREAN: + return "EUC-KR"; + case Constants.CP_MAC_ARABIC: + return "MacArabic"; + case Constants.CP_MAC_HEBREW: + return "MacHebrew"; + case Constants.CP_MAC_GREEK: + return "MacGreek"; + case Constants.CP_MAC_CYRILLIC: + return "MacCyrillic"; + case Constants.CP_MAC_CHINESE_SIMPLE: + return "EUC_CN"; + case Constants.CP_MAC_ROMANIA: + return "MacRomania"; + case Constants.CP_MAC_UKRAINE: + return "MacUkraine"; + case Constants.CP_MAC_THAI: + return "MacThai"; + case Constants.CP_MAC_CENTRAL_EUROPE: + return "MacCentralEurope"; + case Constants.CP_MAC_ICELAND: + return "MacIceland"; + case Constants.CP_MAC_TURKISH: + return "MacTurkish"; + case Constants.CP_MAC_CROATIAN: + return "MacCroatian"; case Constants.CP_SJIS: return "SJIS"; case Constants.CP_UTF16: