-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.jcodings.transcode; | ||
|
||
import org.jcodings.Ptr; | ||
import org.junit.Test; | ||
import org.junit.Assert; | ||
import java.util.Arrays; | ||
|
||
public class TestCP51932ToCP50220 { | ||
@Test | ||
public void testCP51932ToCP50220() throws Exception { | ||
byte[] src = "\u008E\u00A1\u008E\u00FE".getBytes("iso-8859-1"); | ||
byte[] dst = new byte[100]; | ||
Ptr srcPtr = new Ptr(0); | ||
Ptr dstPtr = new Ptr(0); | ||
EConv econv = TranscoderDB.open("CP51932", "CP50220", 0); | ||
econv.convert(src, srcPtr, src.length, dst, dstPtr, dst.length, 0); | ||
|
||
byte[] str = Arrays.copyOf(dst, dstPtr.p); | ||
|
||
byte[] expected = "\u001B\u0024\u0042\u0021\u0023\u001B\u0028\u0049\u007E\u001B\u0028\u0042".getBytes("iso-8859-1"); | ||
byte[] actual = Arrays.copyOf(dst, dstPtr.p); | ||
Assert.assertEquals(new String(expected), new String(actual)); | ||
} | ||
} |