Skip to content

Commit

Permalink
add utf8 -> utf-8 alias
Browse files Browse the repository at this point in the history
  • Loading branch information
lopex committed Jul 23, 2019
1 parent 8e09c6c commit ead9882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/generate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate_encoding_list

defines, other = open("#{REPO_PATH}/encdb.h").read.tr('()', '').scan(/ENC_([A-Z_]+)(.*?);/m).partition { |a, b| a =~ /DEFINE/ }
other << ["ALIAS", "\"MS932\", \"Windows-31J\""]
other << ["ALIAS", "\"UTF8\", \"UTF-8\""]

open("#{SRC_DIR}/EncodingList.java", "wb") { |f| f << open("EncodingListTemplate.java", "rb").read.
sub(/%\{defines\}/, defines.map { |cmd, name| "#{INDENT*2}EncodingDB.declare(#{name}, \"#{enc_map[name[/[^"]+/]] || (raise 'class not found for encoding ' + name)}\");" }.join("\n")).
Expand Down
1 change: 1 addition & 0 deletions src/org/jcodings/EncodingList.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ static final void load() {
EncodingDB.replicate("UTF8-SoftBank", "UTF-8");
EncodingDB.replicate("SJIS-SoftBank", "Windows-31J");
EncodingDB.alias("MS932", "Windows-31J");
EncodingDB.alias("UTF8", "UTF-8");
}

public static Encoding getInstance(String name) {
Expand Down

0 comments on commit ead9882

Please sign in to comment.