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

UTF-8 support #10

Open
Ratatosk42 opened this issue Feb 26, 2015 · 8 comments
Open

UTF-8 support #10

Ratatosk42 opened this issue Feb 26, 2015 · 8 comments
Labels

Comments

@Ratatosk42
Copy link

Something don't work in UTF-8 :

git-game:40:in `split': invalid byte sequence in UTF-8 (ArgumentError)
@debugger22
Copy link

Got this in SymPy repo:

/usr/bin/git-game:40:in `split': invalid byte sequence in UTF-8 (ArgumentError)
    from /usr/bin/git-game:40:in `<main>'

@myoffe
Copy link

myoffe commented Feb 26, 2015

I'm getting this in my private repo:

/usr/local/bin/git-game:40:in `split': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/local/bin/git-game:40:in `<main>'

@mo
Copy link

mo commented Feb 26, 2015

I hacked around this using:

diff --git git-game git-game
index fcde219..be22b74 100755
--- git-game
+++ git-game
@@ -37,7 +37,9 @@ FIELD_DELIMITER = "|||"

commit_format = ["%an", "%ar", "%B"].join(FIELD_DELIMITER)

-raw_commits = git log --no-merges --pretty="#{COMMIT_DELIMITER}#{commit_format}" #{input if input}.split("#{COMMIT_DELIMITER}")
+raw_commits = git log --no-merges --pretty="#{COMMIT_DELIMITER}#{commit_format}" #{input if input}
+raw_commits = raw_commits.encode("utf-8", "binary", :undef => :replace)
+raw_commits = raw_commits.split("#{COMMIT_DELIMITER}")
commits = []
raw_commits.each do |c|
next if c.strip.empty?

...too ugly for PR though.

@Ratatosk42
Copy link
Author

It's working for me !

@pesterhazy
Copy link

mo's patch works for me (although the backticks were stripped because of github's markdown)

@mreishus
Copy link

you can just chain it:

raw_commits = `git log --no-merges --pretty="#{COMMIT_DELIMITER}#{commit_format}" #{input if input}`.encode("utf-8", "binary", :undef => :replace).split("#{COMMIT_DELIMITER}")

@jsomers
Copy link
Owner

jsomers commented Feb 28, 2015

@gzugmeyer @pesterhazy @mo Want to give @mreishus's patch a try? If that works and if someone wants to submit a pull I will happily merge it

@jsomers jsomers added the bug label Feb 28, 2015
@Ratatosk42
Copy link
Author

It's done : #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants