Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows encoding problems #2146

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/pry/code/code_file.rb
Expand Up @@ -31,7 +31,7 @@ class CodeFile

# Store the current working directory. This allows show-source etc. to work if
# your process has changed directory since boot. [Issue #675]
INITIAL_PWD = Dir.pwd
INITIAL_PWD = Dir.pwd.encode('UTF-8')

# @return [Symbol] The type of code stored in this wrapper.
attr_reader :code_type
Expand Down Expand Up @@ -98,7 +98,7 @@ def type_from_filename(filename, default = :unknown)

# @return [String]
def from_pwd
File.expand_path(@filename, Dir.pwd)
File.expand_path(@filename, Dir.pwd.encode('UTF-8'))
end

# @return [String]
Expand Down
2 changes: 1 addition & 1 deletion lib/pry/commands/shell_command.rb
Expand Up @@ -41,7 +41,7 @@ def parse_destination(dest)
end

def process_cd(dest)
state.old_pwd = Dir.pwd
state.old_pwd = Dir.pwd.encode('UTF-8')
Dir.chdir(File.expand_path(path_from_cd_path(dest) || dest))
rescue Errno::ENOENT
raise CommandError, "No such directory: #{dest}"
Expand Down
2 changes: 1 addition & 1 deletion lib/pry/commands/whereami.rb
Expand Up @@ -86,7 +86,7 @@ def bad_option_combination?
end

def location
"#{@file}:#{@line} #{@method && @method.name_with_owner}"
"#{@file.encode('UTF-8')}:#{@line} #{@method && @method.name_with_owner}"
end

def process
Expand Down
2 changes: 1 addition & 1 deletion lib/pry/prompt.rb
Expand Up @@ -200,7 +200,7 @@ def [](key)
"%<name>s %<context>s:%<pwd>s %<separator>s ",
name: pry_instance.config.prompt_name,
context: Pry.view_clip(context),
pwd: Dir.pwd,
pwd: Dir.pwd.encode('UTF-8'),
separator: sep
)
end
Expand Down