Last active
July 9, 2021 10:49
-
-
Save Inversion-des/75949795cc5be707c19d31901e79d1cf to your computer and use it in GitHub Desktop.
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
# ц | |
puts `chcp` | |
p Encoding.default_external | |
p file:__FILE__ | |
p dir:__dir__ | |
puts '-'*10 | |
p LOAD_PATH:$LOAD_PATH[0] | |
p start_with:$LOAD_PATH[0].start_with?(__dir__) | |
# ----- workaround -------------------------------------------------------- | |
# p Gem_dir:Gem.dir | |
# Gem.dir.force_encoding("UTF-8") | |
# p Gem_dir:Gem.dir | |
# p Gem_path:Gem.path | |
# Gem.path.each {|path| path.force_encoding 'UTF-8' } | |
# p Gem_path:Gem.path | |
# if $:[0].encoding.name == 'Windows-1251' | |
# $:.each {|path| path.encode! 'UTF-8' } | |
# $:.push '.' # somehow it helps, looks like a modification of array is needed | |
# end | |
# ----- /workaround -------------------------------------------------------- | |
# puts 'bundler/setup' | |
# # fails: incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) | |
# require 'bundler/setup' | |
puts '='*10 | |
require_relative 'f2' |
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
# ц | |
puts `chcp` | |
p Encoding.default_external | |
p file:__FILE__ | |
p dir:__dir__ | |
puts '-'*10 | |
p LOAD_PATH:$LOAD_PATH[0] | |
# fails: incompatible character encodings: Windows-1251 and UTF-8 (Encoding::CompatibilityError) | |
p start_with:$LOAD_PATH[0].start_with?(__dir__) | |
# fails: incompatible character encodings: UTF-8 and ASCII-8BIT (Encoding::CompatibilityError) | |
p start_with:$LOAD_PATH[0].start_with?(Gem.dir) | |
puts 'bundler/setup' | |
# fails: incompatible character encodings: ASCII-8BIT and UTF-8 (Encoding::CompatibilityError) | |
p require 'bundler/setup' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment