Skip to content

Commit 64a048c

Browse files
committed
Add support for UTF-7 and ISO-8859-8-I encodings.
1 parent bf065fb commit 64a048c

File tree

4 files changed

+79
-3
lines changed

4 files changed

+79
-3
lines changed

pom.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
<artifactId>slf4j-jcl</artifactId>
116116
<version>${slf4j.version}</version>
117117
</dependency>
118+
<dependency>
119+
<groupId>com.beetstra.jutf7</groupId>
120+
<artifactId>jutf7</artifactId>
121+
<version>1.0.0</version>
122+
</dependency>
123+
<!-- Testing dependencies -->
118124
<dependency>
119125
<groupId>org.junit.jupiter</groupId>
120126
<artifactId>junit-jupiter-api</artifactId>
@@ -164,9 +170,9 @@
164170
<artifactId>maven-assembly-plugin</artifactId>
165171
<version>3.7.1</version>
166172
<configuration>
167-
<descriptorRefs>
168-
<descriptorRef>jar-with-dependencies</descriptorRef>
169-
</descriptorRefs>
173+
<descriptors>
174+
<descriptor>src/assembly/assembly.xml</descriptor>
175+
</descriptors>
170176
<appendAssemblyId>false</appendAssemblyId>
171177
<archive>
172178
<manifest>

src/assembly/assembly.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd">
4+
<id>jar-with-dependencies</id>
5+
<formats>
6+
<format>jar</format>
7+
</formats>
8+
<includeBaseDirectory>false</includeBaseDirectory>
9+
<dependencySets>
10+
<dependencySet>
11+
<outputDirectory>/</outputDirectory>
12+
<useProjectArtifact>true</useProjectArtifact>
13+
<unpack>true</unpack>
14+
<scope>runtime</scope>
15+
</dependencySet>
16+
</dependencySets>
17+
<containerDescriptorHandlers>
18+
<containerDescriptorHandler>
19+
<handlerName>metaInf-services</handlerName>
20+
</containerDescriptorHandler>
21+
</containerDescriptorHandlers>
22+
</assembly>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2024 Carlos Machado
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package pt.cjmach.pstconv.charsets;
17+
18+
import java.nio.charset.Charset;
19+
import java.nio.charset.spi.CharsetProvider;
20+
import java.util.HashSet;
21+
import java.util.Iterator;
22+
23+
/**
24+
*
25+
* @author cmachado
26+
*/
27+
public class ISO88598ICharsetProvider extends CharsetProvider {
28+
private static final String CHARSET_NAME = "ISO-8859-8-I";
29+
30+
private final Charset charset = Charset.forName("ISO-8859-8");
31+
32+
@Override
33+
public Iterator<Charset> charsets() {
34+
HashSet<Charset> set = new HashSet<>(1);
35+
set.add(charset);
36+
return set.iterator();
37+
}
38+
39+
@Override
40+
public Charset charsetForName(String charsetName) {
41+
if (CHARSET_NAME.equalsIgnoreCase(charsetName)) {
42+
return charset;
43+
}
44+
return null;
45+
}
46+
47+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pt.cjmach.pstconv.charsets.ISO88598ICharsetProvider

0 commit comments

Comments
 (0)