Last active
December 14, 2015 16:48
-
-
Save znz/5117644 to your computer and use it in GitHub Desktop.
gsub_file with UTF-8 regexp causes Encoding::CompatibilityError. related issue is https://github.com/wycats/thor/issues/191
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
create_file "config/locales/foo.yml", <<-'YAML' | |
ja: | |
foo: "foo" | |
YAML | |
gsub_file "config/locales/foo.yml", /"foo"/, '"bar"' | |
create_file "config/locales/hoge.yml", <<-'YAML' | |
ja: | |
hoge: "ほげ" | |
YAML | |
gsub_file "config/locales/hoge.yml", /"ほげ"/, '"ふが"' |
This file contains hidden or 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
% bundle exec rails -v | |
Rails 3.2.12 | |
% bundle exec rake rails:template LOCATION=https://gist.github.com/znz/5117644/raw/f0280d2f3ad7faaa40a578600675d9b8d481e242/ex.rb | |
create config/locales/foo.yml | |
gsub config/locales/foo.yml | |
create config/locales/hoge.yml | |
gsub config/locales/hoge.yml | |
rake aborted! | |
incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment