Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jcodings
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: de58ad6cd2c0
Choose a base ref
...
head repository: jruby/jcodings
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 97c69ee9b4eb
Choose a head ref

Commits on Feb 24, 2014

  1. Copy the full SHA
    88db045 View commit details

Commits on Feb 25, 2014

  1. Fill out rest of CFG.

    headius committed Feb 25, 2014
    Copy the full SHA
    c95ec11 View commit details
  2. Rename transcoding bodies.

    headius committed Feb 25, 2014
    Copy the full SHA
    7277c51 View commit details
  3. Copy the full SHA
    395b779 View commit details
  4. Copy the full SHA
    a9c4940 View commit details
  5. More transcoder porting and impl.

    * Wire up more transcoder functions correctly.
    * Fix minor porting bugs to get a basic transcode to work.
    * Add first test for EConv.
    headius committed Feb 25, 2014
    Copy the full SHA
    0bf4f37 View commit details
  6. Copy the full SHA
    c82f40d View commit details
  7. Copy the full SHA
    e03b312 View commit details

Commits on Feb 26, 2014

  1. More minor opto.

    * Use ints for state machine to avoid indirection through enums.
    * Inline transcoding buffer accessors.
    headius committed Feb 26, 2014
    Copy the full SHA
    9080714 View commit details
  2. Copy the full SHA
    2e4b20f View commit details

Commits on Mar 4, 2014

  1. Copy the full SHA
    acfa01d View commit details
  2. Copy the full SHA
    408aded View commit details
  3. More transcoding support for Unicode.

    * UTF-16 and UTF-32 should be done now.
    * UTF-8-MAC still missing.
    * General UTF-8 may be done already.
    headius committed Mar 4, 2014
    Copy the full SHA
    4034503 View commit details
  4. Copy the full SHA
    4756cc4 View commit details
  5. Add TranscodeFunctions.

    headius committed Mar 4, 2014
    Copy the full SHA
    eb462ef View commit details
  6. Add basic tests for EConv.

    headius committed Mar 4, 2014
    Copy the full SHA
    13925e3 View commit details
  7. Reformat code.

    headius committed Mar 4, 2014
    Copy the full SHA
    79d5ede View commit details
  8. Copy the full SHA
    4ea4f38 View commit details
  9. Copy the full SHA
    3c63aca View commit details

Commits on Mar 5, 2014

  1. Copy the full SHA
    45b142c View commit details
  2. Copy the full SHA
    1bbaac6 View commit details
  3. Copy the full SHA
    19beaee View commit details
  4. Copy the full SHA
    ef57ec5 View commit details
  5. Add test for EConvResult.

    headius committed Mar 5, 2014
    Copy the full SHA
    3aa0155 View commit details
  6. Enable builds in Travis.

    headius committed Mar 5, 2014
    Copy the full SHA
    a52060d View commit details
  7. Implement ISO-2022-JP-KDDI.

    headius committed Mar 5, 2014
    Copy the full SHA
    9cbd5a5 View commit details

Commits on Mar 8, 2014

  1. Copy the full SHA
    ad2222c View commit details
  2. Copy the full SHA
    f225f62 View commit details
  3. Copy the full SHA
    529e6a3 View commit details

Commits on Mar 10, 2014

  1. Copy the full SHA
    a13b0be View commit details
  2. Copy the full SHA
    3f356f7 View commit details
  3. Copy the full SHA
    078617a View commit details
  4. Fixes for econv_insert_output.

    * Defer alloc of 4096 bytes.
    * Copy into bytes of buf, not into buf.
    headius committed Mar 10, 2014
    Copy the full SHA
    dbbc501 View commit details

Commits on Mar 11, 2014

  1. Copy the full SHA
    a1c4627 View commit details
  2. Copy the full SHA
    79a1d63 View commit details
  3. Add newline transcoders.

    For future reference: MRI appears to generate newline.c, the
    transcoder logic and data, into the root of the Ruby source tree.
    As a result, our scripts did not find it. I moved the .c file and
    ran the scripts, but future updates will need to this or something
    like it.
    headius committed Mar 11, 2014
    Copy the full SHA
    94aae2f View commit details
  4. Copy the full SHA
    531eedf View commit details
  5. Copy the full SHA
    7686be2 View commit details
  6. Copy the full SHA
    defbc27 View commit details
  7. Copy the full SHA
    293bd7c View commit details
  8. Reduce duplication.

    headius committed Mar 11, 2014
    Copy the full SHA
    f29a380 View commit details
  9. Copy the full SHA
    83cd655 View commit details
  10. More tweaks and porting bugs.

    headius committed Mar 11, 2014
    Copy the full SHA
    82414eb View commit details
  11. Copy the full SHA
    fce347a View commit details
  12. Copy the full SHA
    7f5ff7d View commit details
  13. Fixes and tweaks for putback.

    headius committed Mar 11, 2014
    Copy the full SHA
    19fb68f View commit details
  14. Copy the full SHA
    7de555a View commit details
  15. Copy the full SHA
    f81d55f View commit details
  16. Copy the full SHA
    8cd8e40 View commit details

Commits on Mar 12, 2014

  1. More work on transcoder.

    * Re-encapsulate data on EConv.LastError
    * Fix bugs in insertOutput
    * LastError.errorBytesEnd is actually errorBytesLength
    headius committed Mar 12, 2014
    Copy the full SHA
    1877a79 View commit details
Showing with 2,975 additions and 344 deletions.
  1. +1 −0 .travis.yml
  2. BIN resources/tables/Transcoder_Newline_ByteArray.bin
  3. BIN resources/tables/Transcoder_Newline_WordArray.bin
  4. +89 −88 scripts/ExtractTables.rb
  5. +9 −4 src/org/jcodings/EncodingDB.java
  6. +2 −2 src/org/jcodings/EncodingList.java
  7. +2 −2 src/org/jcodings/specific/BaseSJISEncoding.java
  8. +1 −1 src/org/jcodings/specific/NonStrictSJISEncoding.java
  9. +2 −2 src/org/jcodings/specific/SJISEncoding.java
  10. +44 −0 src/org/jcodings/specific/Windows_31JEncoding.java
  11. +3 −3 src/org/jcodings/transcode/AsciiCompatibility.java
  12. +173 −65 src/org/jcodings/transcode/EConv.java
  13. +2 −0 src/org/jcodings/transcode/EConvFlags.java
  14. +29 −7 src/org/jcodings/transcode/EConvResult.java
  15. +1,311 −0 src/org/jcodings/transcode/TranscodeFunctions.java
  16. +37 −22 src/org/jcodings/transcode/Transcoder.java
  17. +43 −27 src/org/jcodings/transcode/TranscoderDB.java
  18. +6 −0 src/org/jcodings/transcode/TranscoderList.java
  19. +564 −120 src/org/jcodings/transcode/Transcoding.java
  20. +20 −0 src/org/jcodings/transcode/specific/Cp50220_decoder_Transcoder.java
  21. +36 −0 src/org/jcodings/transcode/specific/Cp50220_encoder_Transcoder.java
  22. +20 −0 src/org/jcodings/transcode/specific/Cp50221_decoder_Transcoder.java
  23. +36 −0 src/org/jcodings/transcode/specific/Cp50221_encoder_Transcoder.java
  24. +26 −0 src/org/jcodings/transcode/specific/Escape_xml_attr_quote_Transcoder.java
  25. +6 −0 src/org/jcodings/transcode/specific/Eucjp2sjis_Transcoder.java
  26. +6 −0 src/org/jcodings/transcode/specific/Eucjp_to_stateless_iso2022jp_Transcoder.java
  27. +11 −0 src/org/jcodings/transcode/specific/From_GB18030_Transcoder.java
  28. +27 −1 src/org/jcodings/transcode/specific/From_UTF8_MAC_Transcoder.java
  29. +6 −0 src/org/jcodings/transcode/specific/From_UTF_16BE_Transcoder.java
  30. +6 −0 src/org/jcodings/transcode/specific/From_UTF_16LE_Transcoder.java
  31. +22 −0 src/org/jcodings/transcode/specific/From_UTF_16_Transcoder.java
  32. +6 −0 src/org/jcodings/transcode/specific/From_UTF_32BE_Transcoder.java
  33. +6 −0 src/org/jcodings/transcode/specific/From_UTF_32LE_Transcoder.java
  34. +22 −0 src/org/jcodings/transcode/specific/From_UTF_32_Transcoder.java
  35. +20 −0 src/org/jcodings/transcode/specific/Iso2022jp_decoder_Transcoder.java
  36. +36 −0 src/org/jcodings/transcode/specific/Iso2022jp_encoder_Transcoder.java
  37. +20 −0 src/org/jcodings/transcode/specific/Iso2022jp_kddi_decoder_Transcoder.java
  38. +36 −0 src/org/jcodings/transcode/specific/Iso2022jp_kddi_encoder_Transcoder.java
  39. +6 −0 src/org/jcodings/transcode/specific/Sjis2eucjp_Transcoder.java
  40. +6 −0 src/org/jcodings/transcode/specific/Stateless_iso2022jp_to_eucjp_Transcoder.java
  41. +11 −0 src/org/jcodings/transcode/specific/To_GB18030_Transcoder.java
  42. +6 −0 src/org/jcodings/transcode/specific/To_UTF_16BE_Transcoder.java
  43. +6 −0 src/org/jcodings/transcode/specific/To_UTF_16LE_Transcoder.java
  44. +17 −0 src/org/jcodings/transcode/specific/To_UTF_16_Transcoder.java
  45. +6 −0 src/org/jcodings/transcode/specific/To_UTF_32BE_Transcoder.java
  46. +6 −0 src/org/jcodings/transcode/specific/To_UTF_32LE_Transcoder.java
  47. +17 −0 src/org/jcodings/transcode/specific/To_UTF_32_Transcoder.java
  48. +70 −0 src/org/jcodings/transcode/specific/Universal_newline_Transcoder.java
  49. +124 −0 test/org/jcodings/specific/TestEConv.java
  50. +14 −0 test/org/jcodings/specific/TestEConvResult.java
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: java
Binary file added resources/tables/Transcoder_Newline_ByteArray.bin
Binary file not shown.
Binary file added resources/tables/Transcoder_Newline_WordArray.bin
Binary file not shown.
177 changes: 89 additions & 88 deletions scripts/ExtractTables.rb
Original file line number Diff line number Diff line change
@@ -11,121 +11,122 @@
INDENT = " " * 4

def assert_eq a, b, msg = ""
raise "unmet condition: #{a.inspect} == #{b.inspect}, info #{msg}" unless a == b
raise "unmet condition: #{a.inspect} == #{b.inspect}, info #{msg}" unless a == b
end

def assert_not_eq a, b, msg = ""
raise "unmet condition: #{a.inspect} != #{b.inspect}, info: #{msg}" unless a != b
raise "unmet condition: #{a.inspect} != #{b.inspect}, info: #{msg}" unless a != b
end

def extract_to to, file
to = to.map do |t|
case t
when /^0x[0-9a-f]+$/
t.to_i(16)
else
t = t.split(',').map{|t|t.strip}
assert_eq(t.all?{|e|e =~ /^0x[0-9a-f]+$/}, true)
t.map{|t| t.to_i(16)}
end
to = to.map do |t|
case t
when /^0x[0-9a-f]+$/
t.to_i(16)
else
t = t.split(',').map { |t| t.strip }
assert_eq(t.all? { |e| e =~ /^0x[0-9a-f]+$/ }, true)
t.map { |t| t.to_i(16) }
end

open(file, "wb") do |f|
f << [to.size].pack("N")
to.each do |t| case t
when Fixnum
f << [1].pack("N")
f << [t].pack("N")
when Array
f << [t.size].pack("N")
t.each{|tx| f << [tx].pack("N")}
else
raise "foo"
end
end
end

open(file, "wb") do |f|
f << [to.size].pack("N")
to.each do |t|
case t
when Fixnum
f << [1].pack("N")
f << [t].pack("N")
when Array
f << [t.size].pack("N")
t.each { |tx| f << [tx].pack("N") }
else
raise "foo"
end
end
end
end

folds = folds_src.scan(/static\s+const\s+(\w+)\s+(\w+)\[\]\s+=\s+\{(.*?)\}\;/m).map do |(type, name, tab)|
case type
when /Case(\w+)_11_Type/
from, to = tab.scan(/(\w+).+\{\w+?.+?\{(.+?)\s?\}/).transpose

assert_eq(to.size, from.size)
case type
when /Case(\w+)_11_Type/
from, to = tab.scan(/(\w+).+\{\w+?.+?\{(.+?)\s?\}/).transpose

assert_eq(from.all?{|e| e =~ /^0x[0-9a-f]+$/}, true)
from = from.map{|e| e.to_i(16)}
open("#{dst_bin_dir}/#{name}_From.bin", "wb") do |f|
f << [from.size].pack("N")
from.each{|fr| f << [fr].pack("N")}
end
assert_eq(to.size, from.size)

extract_to to, "#{dst_bin_dir}/#{name}_To.bin"
assert_eq(from.all? { |e| e =~ /^0x[0-9a-f]+$/ }, true)
from = from.map { |e| e.to_i(16) }
open("#{dst_bin_dir}/#{name}_From.bin", "wb") do |f|
f << [from.size].pack("N")
from.each { |fr| f << [fr].pack("N") }
end

when "CaseUnfold_12_Type", "CaseUnfold_13_Type"
fld = tab.scan(/\{\s?\{(.+?)\}.+\{\w+?.+?\{(.+?)\s?\}/).flatten
extract_to to, "#{dst_bin_dir}/#{name}_To.bin"

extract_to fld, "#{dst_bin_dir}/#{name}.bin"
else
raise "error"
end
when "CaseUnfold_12_Type", "CaseUnfold_13_Type"
fld = tab.scan(/\{\s?\{(.+?)\}.+\{\w+?.+?\{(.+?)\s?\}/).flatten

extract_to fld, "#{dst_bin_dir}/#{name}.bin"
else
raise "error"
end
end

unicode_src.scan(/static\s+const\s+(\w+)\s+(\w+)\[\]\s+=\s+\{(.*?)\}\;/m).each do |(type, name, tab)|
tab = tab.split(",").map{|e|e.strip}
assert_eq(tab.last, "")
tab.pop
size = tab.size
head = tab.shift
assert_eq(head =~ /^\d+$/, 0)
head = head.to_i

assert_eq(tab[1..-1].all?{|e| e =~ /^0x[0-9a-f]+$/}, true)

tab = tab.map{|e| e.to_i(16)}
assert_eq(tab.all?{|e|e >= 0 && e <= 4294967295}, true)

open("#{dst_bin_dir}/#{name}.bin", "wb") do |f|
f << [size].pack("N")
f << [head].pack("N")
tab.each{|e| f << [e].pack("N") }
end
tab = tab.split(",").map { |e| e.strip }
assert_eq(tab.last, "")
tab.pop

size = tab.size
head = tab.shift

assert_eq(head =~ /^\d+$/, 0)
head = head.to_i

assert_eq(tab[1..-1].all? { |e| e =~ /^0x[0-9a-f]+$/ }, true)

tab = tab.map { |e| e.to_i(16) }
assert_eq(tab.all? { |e| e >= 0 && e <= 4294967295 }, true)

open("#{dst_bin_dir}/#{name}.bin", "wb") do |f|
f << [size].pack("N")
f << [head].pack("N")
tab.each { |e| f << [e].pack("N") }
end
end


cr_map = unicode_src.scan(/#define (CR_.*?) (.*)/).inject(Hash.new{|h, k|k}){|h, (k,v)| h[k] = v;h}
cr_map = unicode_src.scan(/#define (CR_.*?) (.*)/).inject(Hash.new { |h, k| k }) { |h, (k, v)| h[k] = v; h }

aliases = unicode_src[/%%(.*?)%%/m, 1].scan(/(.*?),\s+(\d+)/).inject(Hash.new{|h, k| h[k] = []}){|h, (name, num)| h[num.to_i] << name; h}.inject({}) do |h, (k, v)|
full, *abbr = v.map{|e|e.strip}
h[full] = abbr
h
aliases = unicode_src[/%%(.*?)%%/m, 1].scan(/(.*?),\s+(\d+)/).inject(Hash.new { |h, k| h[k] = [] }) { |h, (name, num)| h[num.to_i] << name; h }.inject({}) do |h, (k, v)|
full, *abbr = v.map { |e| e.strip }
h[full] = abbr
h
end

unicode_src.scan(/CodeRanges\[\]\s+=\s+\{(.*?)\}\;/m) do |e|
names = e.first.scan(/CR_\w+/)

cnames = names.map do |c|
n = c[/CR_(.*)/, 1]
px = case n
when /Age_(\d)_(\d)/
"age=#{$1}.#{$2}"
else
n.tr('_', '').downcase
end

([px] + aliases[px].to_a).map{|n| "#{INDENT * 4}new CodeRangeEntry(\"#{n}\", \"#{cr_map[c]}\")"}.join(",\n")
end

open("#{enc_dir}/UnicodeProperties.java", "wb") do |f|
f << open("UnicodePropertiesTemplate.java", "rb").read.
names = e.first.scan(/CR_\w+/)

cnames = names.map do |c|
n = c[/CR_(.*)/, 1]
px = case n
when /Age_(\d)_(\d)/
"age=#{$1}.#{$2}"
else
n.tr('_', '').downcase
end

([px] + aliases[px].to_a).map { |n| "#{INDENT * 4}new CodeRangeEntry(\"#{n}\", \"#{cr_map[c]}\")" }.join(",\n")
end

open("#{enc_dir}/UnicodeProperties.java", "wb") do |f|
f << open("UnicodePropertiesTemplate.java", "rb").read.
sub(/%\{stdcrs\}/, cnames[0..14].join(",\n")).
sub(/%\{extcrs\}/, cnames.join(",\n"))
end
end
end

enc_db = open("#{repo_path}/encdb.h").read.tr('()', '').scan(/ENC_([A-Z_]+)(.*?);/m).reject{|a, b| a =~ /DEFINE/}
enc_db = open("#{repo_path}/encdb.h").read.tr('()', '').scan(/ENC_([A-Z_]+)(.*?);/m).reject { |a, b| a =~ /DEFINE/ }

open("#{dst_dir}/EncodingList.java", "wb"){|f| f << open("EncodingListTemplate.java", "rb").read.
sub(/%\{body\}/, enc_db.map{|cmd, from, to| "#{INDENT*2}{\"#{cmd[0,1]}\", #{from}#{to.nil? ? "" : to}}"}.join(",\n"))}
open("#{dst_dir}/EncodingList.java", "wb") { |f| f << open("EncodingListTemplate.java", "rb").read.
sub(/%\{body\}/, enc_db.map { |cmd, from, to| "#{INDENT*2}{\"#{cmd[0, 1]}\", #{from}#{to.nil? ? "" : to}}" }.join(",\n")) }
13 changes: 9 additions & 4 deletions src/org/jcodings/EncodingDB.java
Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ public boolean isDummy() {
"UTF-32LE", "UTF32LE",
"Windows-1251", "CP1251",
"GB2312", "EUCKR", // done via rb_enc_register
"Windows-31J", "SJIS" // TODO: Windows-31J is actually a variant of SJIS
"Windows-31J", "Windows_31J" // TODO: Windows-31J is actually a variant of SJIS
};

static Entry ascii;
@@ -177,10 +177,15 @@ public static void replicate(String replica, String original) {
public static void set_base(String name, String original) {
}

public static Entry dummy(byte[] bytes) {
if (encodings.get(bytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_ALREADY_REGISTERED, new String(bytes));
Entry entry = new Entry(bytes);
encodings.putDirect(bytes, entry);
return entry;
}

public static void dummy(String name) {
byte[]bytes = name.getBytes();
if (encodings.get(bytes) != null) throw new InternalException(ErrorMessages.ERR_ENCODING_ALREADY_REGISTERED, name);
encodings.putDirect(bytes, new Entry(bytes));
dummy(name.getBytes());
}

static {
4 changes: 2 additions & 2 deletions src/org/jcodings/EncodingList.java
Original file line number Diff line number Diff line change
@@ -133,8 +133,8 @@ final class EncodingList {
{"R", "UTF8-MAC", "UTF-8"},
{"A", "UTF-8-MAC", "UTF8-MAC"},
{"A", "UTF-8-HFS", "UTF8-MAC" /* Emacs 23.2 */},
{"D", "UTF-16"},
{"D", "UTF-32"},
{"R", "UTF-16", "UTF-16BE"},
{"R", "UTF-32", "UTF-32BE"},
{"A", "UCS-2BE", "UTF-16BE"},
{"A", "UCS-4BE", "UTF-32BE"},
{"A", "UCS-4LE", "UTF-32LE"},
4 changes: 2 additions & 2 deletions src/org/jcodings/specific/BaseSJISEncoding.java
Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@

abstract class BaseSJISEncoding extends CanBeTrailTableEncoding {

protected BaseSJISEncoding(int[][]Trans) {
super("Shift_JIS", 1, 2, SjisEncLen, Trans, AsciiTables.AsciiCtypeTable, SJIS_CAN_BE_TRAIL_TABLE);
protected BaseSJISEncoding(String name, int[][]Trans) {
super(name, 1, 2, SjisEncLen, Trans, AsciiTables.AsciiCtypeTable, SJIS_CAN_BE_TRAIL_TABLE);
}

@Override
2 changes: 1 addition & 1 deletion src/org/jcodings/specific/NonStrictSJISEncoding.java
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
public final class NonStrictSJISEncoding extends BaseSJISEncoding {

protected NonStrictSJISEncoding() {
super(null);
super("Shift_JIS", null);
}

@Override
4 changes: 2 additions & 2 deletions src/org/jcodings/specific/SJISEncoding.java
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
public final class SJISEncoding extends BaseSJISEncoding {

protected SJISEncoding() {
super(SjisTrans);
super("Shift_JIS", SjisTrans);
}

@Override
@@ -36,7 +36,7 @@ public int length(byte[]bytes, int p, int end) {
}
}

private static final int SjisTrans[][] = Config.VANILLA ? null : new int[][]{
static final int SjisTrans[][] = Config.VANILLA ? null : new int[][]{
{ /* S0 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
/* 1 */ A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
44 changes: 44 additions & 0 deletions src/org/jcodings/specific/Windows_31JEncoding.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.jcodings.specific;

import org.jcodings.Config;

public final class Windows_31JEncoding extends BaseSJISEncoding {
protected Windows_31JEncoding() {
super("Windows-31J", SJISEncoding.SjisTrans);
}

@Override
public String getCharsetName() {
return "Windows-31J";
}

@Override
public int length(byte[]bytes, int p, int end) {
if (Config.VANILLA) {
return length(bytes[p]);
} else {
return safeLengthForUptoTwo(bytes, p, end);
}
}

public static final Windows_31JEncoding INSTANCE = new Windows_31JEncoding();
}
6 changes: 3 additions & 3 deletions src/org/jcodings/transcode/AsciiCompatibility.java
Original file line number Diff line number Diff line change
@@ -22,15 +22,15 @@
public enum AsciiCompatibility {
CONVERTER, DECODER, ENCODER;

boolean isConverter() {
public boolean isConverter() {
return this == CONVERTER;
}

boolean isDecoder() {
public boolean isDecoder() {
return this == DECODER;
}

boolean isEncoder() {
public boolean isEncoder() {
return this == ENCODER;
}
}
Loading