fix for latest ruby.
@@ -1,7 +1,8 @@ | ||
1 | +# -*- coding: euc-jp -*- | |
1 | 2 | # |
2 | 3 | # hmi_generator.rb |
3 | 4 | # |
4 | -# Copyright (c) 2012 project bchan | |
5 | +# Copyright (c) 2012-2014 project bchan | |
5 | 6 | # |
6 | 7 | # This software is provided 'as-is', without any express or implied |
7 | 8 | # warranty. In no event will the authors be held liable for any damages |
@@ -25,12 +26,11 @@ | ||
25 | 26 | |
26 | 27 | require 'yaml' |
27 | 28 | require 'erb' |
28 | -require 'jcode' | |
29 | 29 | |
30 | 30 | def conv_euc_to_TCArray(str) |
31 | 31 | ret = Array.new(); |
32 | - str.each_char do |x| | |
33 | - i = x.length - 1; | |
32 | + str.encode("EUC-JP").each_char do |x| | |
33 | + i = x.bytesize - 1; | |
34 | 34 | val = 0; |
35 | 35 | x.each_byte do |ch| |
36 | 36 | val += ch << (8 * i); |
@@ -2849,9 +2849,7 @@ | ||
2849 | 2849 | |
2850 | 2850 | end |
2851 | 2851 | |
2852 | -$KCODE = "EUC" | |
2853 | - | |
2854 | -yaml = YAML.load_file(ARGV[0]); | |
2852 | +yaml = YAML.load(File.read(ARGV[0], encoding: 'EUC-JP:UTF-8')); | |
2855 | 2853 | data = HMIData.new(yaml); |
2856 | 2854 | |
2857 | 2855 | fname_header = yaml["generator"]["output_header"] |
@@ -1,3 +1,4 @@ | ||
1 | +# -*- coding: euc-jp -*- | |
1 | 2 | # |
2 | 3 | # panel_generator.rb |
3 | 4 | # |
@@ -25,12 +26,11 @@ | ||
25 | 26 | |
26 | 27 | require 'yaml' |
27 | 28 | require 'erb' |
28 | -require 'jcode' | |
29 | 29 | |
30 | 30 | def conv_euc_to_TCArray(str) |
31 | 31 | ret = Array.new(); |
32 | - str.each_char do |x| | |
33 | - i = x.length - 1; | |
32 | + str.encode("EUC-JP").each_char do |x| | |
33 | + i = x.bytesize - 1; | |
34 | 34 | val = 0; |
35 | 35 | x.each_byte do |ch| |
36 | 36 | val += ch << (8 * i); |
@@ -547,9 +547,7 @@ | ||
547 | 547 | fd.close |
548 | 548 | end |
549 | 549 | |
550 | -$KCODE = "EUC" | |
551 | - | |
552 | -yaml = YAML.load_file(ARGV[0]); | |
550 | +yaml = YAML.load(File.read(ARGV[0], encoding: 'EUC-JP:UTF-8')); | |
553 | 551 | data = PanelData.new(yaml); |
554 | 552 | |
555 | 553 | fname_header = yaml["generator"]["output_header"] |