[Git][java-team/libjuniversalchardet-java][master] 5 commits: Declare compliance with Debian Policy 4.7.0.

Markus Koschany (@apo) gitlab at salsa.debian.org
Sun Feb 9 17:33:58 GMT 2025



Markus Koschany pushed to branch master at Debian Java Maintainers / libjuniversalchardet-java


Commits:
cb9eb3da by Markus Koschany at 2025-02-09T18:14:05+01:00
Declare compliance with Debian Policy 4.7.0.

- - - - -
db81c861 by Markus Koschany at 2025-02-09T18:14:38+01:00
Update copyright years

- - - - -
e4141862 by Markus Koschany at 2025-02-09T18:14:58+01:00
New upstream version 2.5.0
- - - - -
485788a0 by Markus Koschany at 2025-02-09T18:14:59+01:00
Update upstream source from tag 'upstream/2.5.0'

Update to upstream version '2.5.0'
with Debian dir fc28c180e7fe05ddf8028629124a8bce86de2002
- - - - -
e54f1467 by Markus Koschany at 2025-02-09T18:16:14+01:00
Update changelog

- - - - -


19 changed files:

- + .github/workflows/maven.yml
- .gitignore
- − .travis.yml
- + build.gradle
- debian/changelog
- debian/control
- debian/copyright
- pom.xml
- + settings.gradle
- src/main/java/org/mozilla/universalchardet/Constants.java
- src/main/java/org/mozilla/universalchardet/ReaderFactory.java
- src/main/java/org/mozilla/universalchardet/UniversalDetector.java
- src/main/java/org/mozilla/universalchardet/prober/MBCSGroupProber.java
- src/main/java/org/mozilla/universalchardet/prober/SBCSGroupProber.java
- src/main/java/org/mozilla/universalchardet/prober/distributionanalysis/EUCKRDistributionAnalysis.java
- src/main/java/org/mozilla/universalchardet/prober/sequence/CyrillicModel.java
- src/main/java/org/mozilla/universalchardet/prober/statemachine/Big5SMModel.java
- src/main/java/org/mozilla/universalchardet/prober/statemachine/CodingStateMachine.java
- + src/test/java/org/mozilla/universalchardet/ByteArrayReaderTest.java


Changes:

=====================================
.github/workflows/maven.yml
=====================================
@@ -0,0 +1,25 @@
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: juniversalchardet CI
+on:
+  push:
+    branches: [ main, 2.5.x ]
+  pull_request:
+    branches: [ main, 2.5.x ]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        java: [ 8, 11, 17 ]
+    name: Java ${{matrix.java}}
+    steps:
+      - uses: actions/checkout at v2
+      - name: Setup java
+        uses: actions/setup-java at v1
+        with:
+          java-version: ${{matrix.java}}
+      - name: Build with Maven
+        run: mvn -B -Dgpg.skip=true -Dmaven.javadoc.skip=true clean package verify


=====================================
.gitignore
=====================================
@@ -3,3 +3,5 @@ target/
 .classpath
 .settings/
 *~
+build/
+.gradle/


=====================================
.travis.yml deleted
=====================================
@@ -1,12 +0,0 @@
-language: java
-
-dist: trusty
-
-install: mvn install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true
-
-jdk:
-  - openjdk7
-  - openjdk8
-  - openjdk9
-  - openjdk10
-  - openjdk11


=====================================
build.gradle
=====================================
@@ -0,0 +1,45 @@
+plugins {
+    id ('com.android.library') version "8.2.0"
+}
+
+repositories {
+    mavenCentral()
+    google()
+}
+
+dependencies {
+    testImplementation 'junit:junit:4.13.2'
+    testImplementation 'commons-codec:commons-codec:1.13'
+}
+
+
+sourceSets {
+    main {
+        java {
+            exclude 'src/main/java/module-info.java'
+            exclude 'module-info.java'
+        }
+    }
+}
+
+
+android {
+    namespace "com.github.albfernandez.juniversalchardet"
+    compileSdkVersion 26
+    compileSdk 26
+    defaultConfig {
+        minSdkVersion 26   
+        targetSdkVersion 26
+        compileSdk 26
+        versionCode 1
+        versionName "1.0"
+    }
+    compileOptions {
+        sourceCompatibility  JavaVersion.VERSION_1_7
+        targetCompatibility  JavaVersion.VERSION_1_7
+    }
+    lintOptions {
+        disable 'ExpiredTargetSdkVersion'
+    }
+}
+


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libjuniversalchardet-java (2.5.0-1) unstable; urgency=medium
+
+  * New upstream version 2.5.0.
+  * Declare compliance with Debian Policy 4.7.0.
+
+ -- Markus Koschany <apo at debian.org>  Sun, 09 Feb 2025 18:15:36 +0100
+
 libjuniversalchardet-java (2.4.0-3) unstable; urgency=medium
 
   * Team upload


=====================================
debian/control
=====================================
@@ -9,7 +9,7 @@ Build-Depends:
  debhelper-compat (= 13),
  default-jdk,
  maven-debian-helper
-Standards-Version: 4.6.1
+Standards-Version: 4.7.0
 Vcs-Git: https://salsa.debian.org/java-team/libjuniversalchardet-java.git
 Vcs-Browser: https://salsa.debian.org/java-team/libjuniversalchardet-java
 Homepage: https://github.com/albfernandez/juniversalchardet


=====================================
debian/copyright
=====================================
@@ -13,7 +13,7 @@ License: MPL-1.1 or GPL-2+ or LGPL-2.1+
 
 Files: debian/*
 Copyright: 2012, Thomas Koch <thomas at koch.ro>
-           2021-2022, Markus Koschany <apo at debian.org>
+           2021-2025, Markus Koschany <apo at debian.org>
            2022, tony mancill <tmancill at debian.org>
 License: GPL-2+
 


=====================================
pom.xml
=====================================
@@ -4,7 +4,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>com.github.albfernandez</groupId>
 	<artifactId>juniversalchardet</artifactId>
-	<version>2.4.0</version>
+	<version>2.5.0</version>
 	<url>https://github.com/albfernandez/juniversalchardet</url>
 	<packaging>jar</packaging>
 	<name>juniversalchardet</name>
@@ -48,7 +48,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 
-		<version.spotbugs-maven-plugin>4.1.4</version.spotbugs-maven-plugin>
+		<version.spotbugs-maven-plugin>4.4.2.2</version.spotbugs-maven-plugin>
 		<version.findsecbugs-plugin>1.11.0</version.findsecbugs-plugin>
 		<version.sb-contrib>7.4.7</version.sb-contrib>
 	</properties>
@@ -64,7 +64,7 @@
 		<dependency>
 			<groupId>commons-codec</groupId>
 			<artifactId>commons-codec</artifactId>
-			<version>1.10</version>
+			<version>1.15</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>
@@ -72,7 +72,6 @@
 
 	<build>
 		<plugins>
-
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-jar-plugin</artifactId>
@@ -118,44 +117,51 @@
 					</execution>
 				</executions>
 			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-gpg-plugin</artifactId>
-				<version>1.6</version>
-				<configuration>
-					<keyname>${gpg.keyname}</keyname>
-					<passphraseServerId>${gpg.keyname}</passphraseServerId>
-				</configuration>
-				<executions>
-					<execution>
-						<id>sign-artifacts</id>
-						<phase>verify</phase>
-						<goals>
-							<goal>sign</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.sonatype.plugins</groupId>
-				<artifactId>nexus-staging-maven-plugin</artifactId>
-				<version>1.6.6</version>
-				<extensions>true</extensions>
-				<configuration>
-					<serverId>ossrh</serverId>
-					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
-					<autoReleaseAfterClose>true</autoReleaseAfterClose>
-				</configuration>
-			</plugin>
 		</plugins>
 	</build>
 
 
 	<profiles>
 		<profile>
-			<id>jdk7on</id>
+			<id>release</id>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-gpg-plugin</artifactId>
+						<version>1.6</version>
+						<configuration>
+							<keyname>${gpg.keyname}</keyname>
+							<passphraseServerId>${gpg.keyname}</passphraseServerId>
+						</configuration>
+						<executions>
+							<execution>
+								<id>sign-artifacts</id>
+								<phase>verify</phase>
+								<goals>
+									<goal>sign</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.sonatype.plugins</groupId>
+						<artifactId>nexus-staging-maven-plugin</artifactId>
+						<version>1.6.6</version>
+						<extensions>true</extensions>
+						<configuration>
+							<serverId>ossrh</serverId>
+							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
+							<autoReleaseAfterClose>true</autoReleaseAfterClose>
+						</configuration>
+					</plugin>					
+				</plugins>
+			</build>			
+		</profile>
+		<profile>
+			<id>jdk7</id>
 			<activation>
-				<jdk>(,1.8]</jdk>
+				<jdk>(,1.7]</jdk>
 			</activation>
 			<build>
 				<plugins>
@@ -188,6 +194,60 @@
 				</plugins>
 			</build>
 		</profile>
+		<profile>
+			<id>jdk8</id>
+			<activation>
+				<jdk>1.8</jdk>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-compiler-plugin</artifactId>
+						<version>3.7.0</version>
+						<configuration>
+							<excludes>
+								<exclude>module-info.java</exclude>
+							</excludes>
+							<source>${compiler.level}</source>
+							<target>${compiler.level}</target>
+						</configuration>
+					</plugin>
+					<plugin>
+						<groupId>com.github.spotbugs</groupId>
+						<artifactId>spotbugs-maven-plugin</artifactId>
+						<version>${version.spotbugs-maven-plugin}</version>
+						<configuration>
+							<effort>Max</effort>
+							<threshold>Medium</threshold>
+							<includeTests>false</includeTests>
+							<failOnError>false</failOnError>
+							<plugins>
+								<plugin>
+									<groupId>com.h3xstream.findsecbugs</groupId>
+									<artifactId>findsecbugs-plugin</artifactId>
+									<version>${version.findsecbugs-plugin}</version>
+								</plugin>
+								<plugin>
+									<groupId>com.mebigfatguy.sb-contrib</groupId>
+									<artifactId>sb-contrib</artifactId>
+									<version>${version.sb-contrib}</version>
+								</plugin>
+							</plugins>
+						</configuration>
+						<executions>
+							<execution>
+								<id>spotbugs-check</id>
+								<phase>verify</phase>
+								<goals>
+									<goal>check</goal>
+								</goals>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
 		<profile>
 			<id>jdk9on</id>
 			<activation>


=====================================
settings.gradle
=====================================
@@ -0,0 +1,9 @@
+pluginManagement {
+    repositories {
+        gradlePluginPortal()
+        google()
+    }
+}
+
+rootProject.name = 'juniversalchardet'
+


=====================================
src/main/java/org/mozilla/universalchardet/Constants.java
=====================================
@@ -56,7 +56,15 @@ public final class Constants {
     public static final String CHARSET_UTF_32BE     = "UTF-32BE".intern();
     public static final String CHARSET_UTF_32LE     = "UTF-32LE".intern();
     public static final String CHARSET_TIS620       = "TIS620".intern();
+    
+    /**
+     * @deprecated Mispelled, you shoud use {@link #CHARSET_US_ASCII}
+     */
+    @Deprecated
     public static final String CHARSET_US_ASCCI     = "US-ASCII".intern();
+    public static final String CHARSET_US_ASCII     = "US-ASCII".intern();
+    
+    public static final String CHARSET_GBK          = "GBK".intern();
     
     
     // WARNING: Listed below are charsets which Java does not support.


=====================================
src/main/java/org/mozilla/universalchardet/ReaderFactory.java
=====================================
@@ -28,12 +28,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
 
 package org.mozilla.universalchardet;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
+import java.io.*;
 import java.nio.charset.Charset;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -47,14 +42,14 @@ public final class ReaderFactory {
 	private ReaderFactory() {
 		throw new AssertionError("No instances allowed");
 	}
+
 	/**
 	 * Create a reader from a file with correct encoding
 	 * @param file The file to read from
 	 * @param defaultCharset defaultCharset to use if can't be determined
 	 * @return BufferedReader for the file with the correct encoding
-	 * @throws java.io.IOException if some I/O error ocurrs
+	 * @throws java.io.IOException if some I/O error occurs
 	 */
-	
 	public static BufferedReader createBufferedReader(File file, Charset defaultCharset) throws IOException {
 		Charset cs = Objects.requireNonNull(defaultCharset, "defaultCharset must be not null");
 		String detectedEncoding = UniversalDetector.detectCharset(file);
@@ -67,23 +62,59 @@ public final class ReaderFactory {
 		Path path = file.toPath();
 		return new BufferedReader(new InputStreamReader(new UnicodeBOMInputStream(new BufferedInputStream(Files.newInputStream(path))), cs));
 	}
+	
 	/**
 	 * Create a reader from a file with correct encoding. If charset cannot be determined, 
 	 * it uses the system default charset.
 	 * @param file The file to read from
 	 * @return BufferedReader for the file with the correct encoding
-	 * @throws java.io.IOException if some I/O error ocurrs
+	 * @throws java.io.IOException if some I/O error occurs
 	 */
 	public static BufferedReader createBufferedReader(File file) throws IOException {
 		return createBufferedReader(file, Charset.defaultCharset());
 	}
+
+	
+	/**
+	 * Create a reader from a byte array with correct encoding
+	 * @param data The byte[] to read from
+	 * @param defaultCharset defaultCharset to use if can't be determined
+	 * @return BufferedReader for the file with the correct encoding
+	 * @throws java.io.IOException if some I/O error occurs
+	 */
+	public static BufferedReader createBufferedReader(byte[] data, Charset defaultCharset) throws IOException {
+		Charset cs = Objects.requireNonNull(defaultCharset, "defaultCharset must be not null");
+		String detectedEncoding = null;
+		try (InputStream is = new ByteArrayInputStream(data)) {
+			detectedEncoding = UniversalDetector.detectCharset(is);
+		}
+
+		if (detectedEncoding != null) {
+			cs = Charset.forName(detectedEncoding);
+		}
+		if (!cs.name().contains("UTF")) {
+			return new BufferedReader(new InputStreamReader(new ByteArrayInputStream(data), cs));
+		}
+		return new BufferedReader(new InputStreamReader(new UnicodeBOMInputStream(new ByteArrayInputStream(data)), cs));
+	}
+	
+	/**
+	 * Create a reader from a byte array with correct encoding. If charset cannot be determined, 
+	 * it uses the system default charset.
+	 * @param data The byte[] to read from
+	 * @return BufferedReader for the file with the correct encoding
+	 * @throws java.io.IOException if some I/O error occurs
+	 */
+	public static BufferedReader createBufferedReader(byte[] data) throws IOException {
+		return createBufferedReader(data, Charset.defaultCharset());
+	}
 	
 	/**
 	 * Create a reader from a file with the correct encoding
 	 * @param file The file to read from
 	 * @param defaultCharset defaultCharset to use if can't be determined
 	 * @return Reader for the file with the correct encoding
-	 * @throws java.io.IOException if some I/O error ocurrs
+	 * @throws java.io.IOException if some I/O error occurs
 	 * @deprecated Use {@link #createBufferedReader(File, Charset)}
 	 * 	 
 	 */
@@ -96,7 +127,7 @@ public final class ReaderFactory {
 	 * it uses the system default charset.
 	 * @param file The file to read from
 	 * @return Reader for the file with the correct encoding
-	 * @throws java.io.IOException if some I/O error ocurrs
+	 * @throws java.io.IOException if some I/O error occurs
 	 * @deprecated Use {@link #createBufferedReader(File)}
 	 */
 	@Deprecated


=====================================
src/main/java/org/mozilla/universalchardet/UniversalDetector.java
=====================================
@@ -43,7 +43,7 @@
 
 package org.mozilla.universalchardet;
 
-import static org.mozilla.universalchardet.Constants.CHARSET_US_ASCCI;
+import static org.mozilla.universalchardet.Constants.CHARSET_US_ASCII;
 import static org.mozilla.universalchardet.Constants.CHARSET_UTF_16BE;
 import static org.mozilla.universalchardet.Constants.CHARSET_UTF_16LE;
 import static org.mozilla.universalchardet.Constants.CHARSET_UTF_32BE;
@@ -213,7 +213,7 @@ public class UniversalDetector {
                 this.escCharsetProber = new EscCharsetProber();
             }
             st = this.escCharsetProber.handleData(buf, offset, length);
-            if (st == CharsetProber.ProbingState.FOUND_IT) {
+            if (st == CharsetProber.ProbingState.FOUND_IT || 0.99f == this.escCharsetProber.getConfidence()) {
                 this.done = true;
                 this.detectedCharset = this.escCharsetProber.getCharSetName();
             }
@@ -313,7 +313,7 @@ public class UniversalDetector {
         } else if (this.inputState == InputState.ESC_ASCII) {
             // do nothing
         } else if (this.inputState == InputState.PURE_ASCII && this.onlyPrintableASCII) {
-        	this.detectedCharset = CHARSET_US_ASCCI;
+        	this.detectedCharset = CHARSET_US_ASCII;
         }
         else {
             // do nothing


=====================================
src/main/java/org/mozilla/universalchardet/prober/MBCSGroupProber.java
=====================================
@@ -58,12 +58,13 @@ public class MBCSGroupProber extends CharsetProber {
 		super();
 
 
+		
+		probers.add(new GB18030Prober());
 		probers.add(new UTF8Prober());
+		probers.add(new Big5Prober());
 		probers.add(new SJISProber());
 		probers.add(new EUCJPProber());
-		probers.add(new GB18030Prober());
 		probers.add(new EUCKRProber());
-		probers.add(new Big5Prober());
 		probers.add(new EUCTWProber());
 
 		reset();
@@ -137,7 +138,7 @@ public class MBCSGroupProber extends CharsetProber {
         		continue;
         	}
         	st = prober.handleData(highbyteBuf, 0, highpos);
-        	if (st == ProbingState.FOUND_IT) {
+        	if (st == ProbingState.FOUND_IT || 0.99f == prober.getConfidence()) {
                 this.bestGuess = prober;
                 this.state = ProbingState.FOUND_IT;
                 break;


=====================================
src/main/java/org/mozilla/universalchardet/prober/SBCSGroupProber.java
=====================================
@@ -146,7 +146,7 @@ public class SBCSGroupProber extends CharsetProber {
 					continue;
 				}
 				st = prober.handleData(newbuf.array(), 0, newbuf.position());
-				if (st == ProbingState.FOUND_IT) {
+				if (st == ProbingState.FOUND_IT || 0.99f == prober.getConfidence()) {
 					this.bestGuess = prober;
 					this.state = ProbingState.FOUND_IT;
 					break;


=====================================
src/main/java/org/mozilla/universalchardet/prober/distributionanalysis/EUCKRDistributionAnalysis.java
=====================================
@@ -37,8 +37,7 @@
 
 package org.mozilla.universalchardet.prober.distributionanalysis;
 
-public class EUCKRDistributionAnalysis extends CharDistributionAnalysis
-{
+public class EUCKRDistributionAnalysis extends CharDistributionAnalysis {
     ////////////////////////////////////////////////////////////////
     // constants
     ////////////////////////////////////////////////////////////////
@@ -52,16 +51,14 @@ public class EUCKRDistributionAnalysis extends CharDistributionAnalysis
     ////////////////////////////////////////////////////////////////
     // methods
     ////////////////////////////////////////////////////////////////
-    public EUCKRDistributionAnalysis()
-    {
+	public EUCKRDistributionAnalysis() {
         super();
         this.typicalDistributionRatio = EUCKR_TYPICAL_DISTRIBUTION_RATIO;
         this.charToFreqOrder = euckrCharToFreqOrder;
     }
 
     @Override
-    protected int getOrder(final byte[] buf, int offset)
-    {
+	protected int getOrder(final byte[] buf, int offset) {
         int highbyte = buf[offset] & 0xFF;
         if (highbyte >= HIGHBYTE_BEGIN) {
             int lowbyte = buf[offset+1] & 0xFF;


=====================================
src/main/java/org/mozilla/universalchardet/prober/sequence/CyrillicModel.java
=====================================
@@ -37,8 +37,7 @@
 
 package org.mozilla.universalchardet.prober.sequence;
 
-public class CyrillicModel extends SequenceModel
-{
+public class CyrillicModel extends SequenceModel {
     ////////////////////////////////////////////////////////////////
     // constants
     ////////////////////////////////////////////////////////////////
@@ -48,8 +47,7 @@ public class CyrillicModel extends SequenceModel
     ////////////////////////////////////////////////////////////////
     // methods
     ////////////////////////////////////////////////////////////////
-    public CyrillicModel(short[] charToOrderMap, String name)
-    {
+	public CyrillicModel(short[] charToOrderMap, String name) {
         super(
                 charToOrderMap,
                 russianLangModel,


=====================================
src/main/java/org/mozilla/universalchardet/prober/statemachine/Big5SMModel.java
=====================================
@@ -54,8 +54,7 @@ public class Big5SMModel extends SMModel {
     ////////////////////////////////////////////////////////////////
     // methods
     ////////////////////////////////////////////////////////////////
-    public Big5SMModel()
-    {
+	public Big5SMModel() {
         super(
                 new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, big5ClassTable),
                 BIG5_CLASS_FACTOR,


=====================================
src/main/java/org/mozilla/universalchardet/prober/statemachine/CodingStateMachine.java
=====================================
@@ -37,21 +37,18 @@
 
 package org.mozilla.universalchardet.prober.statemachine;
 
-public class CodingStateMachine
-{
+public class CodingStateMachine {
     protected SMModel    model;
     protected int        currentState;
     protected int        currentCharLen;
     protected int        currentBytePos;
     
-    public CodingStateMachine(SMModel model)
-    {
+	public CodingStateMachine(SMModel model) {
         this.model = model;
         this.currentState = SMModel.START;
     }
     
-    public int nextState(byte c)
-    {
+	public int nextState(byte c) {
         int byteCls = this.model.getClass(c);
         if (this.currentState == SMModel.START) {
             this.currentBytePos = 0;
@@ -64,18 +61,15 @@ public class CodingStateMachine
         return this.currentState;
     }
     
-    public int getCurrentCharLen()
-    {
+	public int getCurrentCharLen() {
         return this.currentCharLen;
     }
     
-    public void reset()
-    {
+	public void reset() {
         this.currentState = SMModel.START;
     }
     
-    public String getCodingStateMachine()
-    {
+	public String getCodingStateMachine() {
         return this.model.getName();
     }
 }


=====================================
src/test/java/org/mozilla/universalchardet/ByteArrayReaderTest.java
=====================================
@@ -0,0 +1,31 @@
+package org.mozilla.universalchardet;
+
+import org.junit.Test;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import static org.junit.Assert.assertEquals;
+
+public class ByteArrayReaderTest {
+	
+	private String TEST_STRING = "\u00b0";
+
+	@Test
+	public void utf8() throws IOException {
+		byte[] data = TEST_STRING.getBytes(StandardCharsets.UTF_8);
+		try(BufferedReader bufferedReader = ReaderFactory.createBufferedReader(data)) {
+			assertEquals(TEST_STRING, bufferedReader.readLine());
+		}
+	}
+
+	@Test
+	public void ISO_8859_1() throws IOException {
+		byte[] data = TEST_STRING.getBytes(StandardCharsets.ISO_8859_1);
+		try(BufferedReader bufferedReader = ReaderFactory.createBufferedReader(data)) {
+			assertEquals(TEST_STRING, bufferedReader.readLine());
+		}
+	}
+
+}



View it on GitLab: https://salsa.debian.org/java-team/libjuniversalchardet-java/-/compare/8e634517b18cc22b1bfcc6c20080ba9a6801d29b...e54f14672f8021d2bc70ee585f838e13dfb95188

-- 
View it on GitLab: https://salsa.debian.org/java-team/libjuniversalchardet-java/-/compare/8e634517b18cc22b1bfcc6c20080ba9a6801d29b...e54f14672f8021d2bc70ee585f838e13dfb95188
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250209/460703b7/attachment.htm>


More information about the pkg-java-commits mailing list