Skip to content

Not support Chinese character #295

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

Closed
zesming opened this issue Jun 7, 2016 · 1 comment
Closed

Not support Chinese character #295

zesming opened this issue Jun 7, 2016 · 1 comment

Comments

@zesming
Copy link

zesming commented Jun 7, 2016

I usually get some mojibake if the output information (e.g. g.log.first.author.name) contains some Chinese character, just like '������' .

If I annotate the encoding code (lib.rb line 826 to 866), output would be correct (ruby 2.2.3).

  def command_lines(cmd, opts = [], chdir = true, redirect = '')
      cmd_op = command(cmd, opts, chdir)
    #   op = cmd_op.encode("UTF-8", "binary", {
      #     :invalid => :replace,
        # :undef => :replace
      # })
      cmd_op.split("\n")
  end

I have found an issue and a pull request to add this implementation. Does it a good choice to convert UTF-8 manually?

kamaradclimber added a commit to kamaradclimber/ruby-git that referenced this issue Dec 7, 2016
Before this patch, we always assumed the string was ascii-8bit which
does not work correctly with real utf8 strings (french accented chars or
chineese chars).

This patch tries to use the string as utf8 and fallback if necessary to
the the ascii-8bit assumption if necessary.

This should help with ruby-git#295 and might replace the need for ruby-git#301.

Change-Id: Idac63fa10e5aefafa1eb99a6be4138cac5f90ea0
@stale
Copy link

stale bot commented Apr 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 1, 2018
@stale stale bot closed this as completed Apr 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant