-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy path_codecs_kr.java
More file actions
29 lines (25 loc) · 881 Bytes
/
Copy path_codecs_kr.java
File metadata and controls
29 lines (25 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.python.modules.cjkcodecs;
import org.python.core.Py;
import org.python.core.PyObject;
import org.python.expose.ExposedFunction;
import org.python.expose.ExposedModule;
import java.nio.charset.Charset;
@ExposedModule
public class _codecs_kr {
private static Charset CP949 = Charset.forName("cp949");
private static Charset JOHAB = Charset.forName("johab");
private static Charset EUC_KR = Charset.forName("euc_kr");
@ExposedFunction
public static PyObject getcodec(String name) {
switch(name) {
case "cp949":
return new PyMultibyteCodec(CP949);
case "johab":
return new PyMultibyteCodec(JOHAB);
case "euc_kr":
return new PyMultibyteCodec(EUC_KR);
default:
throw Py.LookupError("no such codec is supported");
}
}
}