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

Windows doesn't support chinese sample #2660

Open
WoolenWang opened this issue Jul 17, 2019 · 7 comments
Open

Windows doesn't support chinese sample #2660

WoolenWang opened this issue Jul 17, 2019 · 7 comments

Comments

@WoolenWang
Copy link

Run options: include {:full_description=>/AGENT::Services::CLI\ �첽������\��python������Ŀ����/}
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/lib/rspec/core/world.rb:182:in `announce_filters'
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/lib/rspec/core/runner.rb:99:in `setup'
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/lib/rspec/core/runner.rb:86:in `run'
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/lib/rspec/core/runner.rb:71:in `run'
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/lib/rspec/core/runner.rb:45:in `invoke'
	from D:/tools/atr/sft_tool/mingw32/lib/ruby/gems/2.3.0/gems/rspec-core-3.8.1/exe/rspec:4:in `<top (required)>'
	from D:/tools/atr/sft_tool/mingw32/bin/rspec:23:in `load'
	from D:/tools/atr/sft_tool/mingw32/bin/rspec:23:in `<top (required)>'
	from -e:1:in `load'
	from -e:1:in `<main>'
@JonRowe
Copy link
Member

JonRowe commented Jul 17, 2019

👋 Can you explain your problem in more detail? What are you trying to achieve thats causing this?

@benoittgt benoittgt changed the title Windows dosn't support chinese sample Windows doesn't support chinese sample Jul 18, 2019
@WoolenWang
Copy link
Author

WoolenWang commented Jul 20, 2019

when using rspec to test a test case in UTF-8 chinese name like:

describe AATM::Build::Mapper do
  describe '将 嵌套哈希数据 转换为 树结构' do
    it '空测试套' do
       pus "test"
    end
  end
end

in this code with windows using cmd:

 rspec D:/git/auto-agent/spec/build/mapper_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "AATM::Build::Mapper 将 嵌套哈希数据 转换为 树结构 空测试套"

with rubymine ide
will get the error above

@benoittgt
Copy link
Member

I don't have a windows machine at the moment but this reproduction script might help us:

begin
  require "bundler/inline"
rescue LoadError => e
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  gem "rspec"
  gem "rspec-teamcity"
end

require 'rspec/autorun'

RSpec.configure do |c|
  c.add_formatter Spec::Runner::Formatter::TeamcityFormatter
  c.default_formatter = Spec::Runner::Formatter::TeamcityFormatter
end

RSpec.describe 'rspec/rspec/44' do
  describe '将 嵌套哈希数据 转换为 树结构' do
    it '空测试套' do
      puts "test"
    end
  end
end

@WoolenWang
Copy link
Author

WoolenWang commented Jul 29, 2019

the key to this problem is not the name in the "describe " or the name in the "it '空测试套' do"
the key is the params get in the params from the command line in windows

rspec D:/git/auto-agent/spec/build/mapper_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "AATM::Build::Mapper 将 嵌套哈希数据 转换为 树结构 空测试套"

the chinese or other none english key name(in the --example) will transfer in the windows encoding (such as gb2312 in chinese or Shift_JIS in japan. )
and our code is in a wide used encoding "utf-8" this may be the problem.[which my code is work fine in linux with utf-8 encoding ]

and we can't change the windows encoding as we can do in linux.

the code you posted i have run in my windows env, is ok to pass.

Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using bundler 1.16.0
Using diff-lcs 1.3
Using rspec-support 3.8.2
Using rspec-core 3.8.2
Using rspec-expectations 3.8.4
Using rspec-mocks 3.8.1
Using rspec 3.8.0
Using rspec-teamcity 1.0.0

##teamcity[enteredTheMatrix timestamp = '2019-07-29T20:22:40.021+0800']

##teamcity[testCount count = '1' timestamp = '2019-07-29T20:22:40.084+0800']

##teamcity[testSuiteStarted name = 'rspec/rspec/44' locationHint = 'file://D:/test.rb:22' timestamp = '2019-07-29T20:22:40.085+0800']

##teamcity[testSuiteStarted name = '将 嵌套哈希数据 转换为 树结构' locationHint = 'file://D:/test.rb:23' timestamp = '2019-07-29T20:22:40.085+0800']

##teamcity[testStarted name = '将 嵌套哈希数据 转换为 树结构 空测试套' captureStandardOutput = 'true' locationHint = 'file://D:/test.rb:24' timestamp = '2019-07-29T20:22:40.085+0800']
test

##teamcity[testFinished name = '将 嵌套哈希数据 转换为 树结构 空测试套' duration = '1564402960086' diagnosticInfo = 'rspec |[3.8.2|], f/s=(1564402960086, 0), duration=1564402960086, time.now=2019-07-29 20:22:40 +0800, raw|[:started_at|]=2019-07-29 20:22:40 +0800, raw|[:finished_at|]=2019-07-29 20:22:40 +0800, raw|[:run_time|]=0.000956' timestamp = '2019-07-29T20:22:40.086+0800']

##teamcity[testSuiteFinished name = '将 嵌套哈希数据 转换为 树结构' timestamp = '2019-07-29T20:22:40.086+0800']

##teamcity[testSuiteFinished name = 'rspec/rspec/44' timestamp = '2019-07-29T20:22:40.086+0800']

1 example, 0 failures, 1 passed

Finished in 0.003988 seconds

is that any chance the rspec will handle the command line encoding corrected and we as a user can ignore the difference in windows encoding and linux encoding.

@benoittgt
Copy link
Member

I am wondering if this PR change can help you? https://github.com/rspec/rspec-core/pull/2575/files

Just to notice that it is still not fixed: #2543 (comment)

@JonRowe JonRowe transferred this issue from rspec/rspec-metagem Sep 3, 2019
@pirj
Copy link
Member

pirj commented Jan 15, 2020

@WoolenWang Can you figure out the difference between the code @benoittgt provided and yours to understand why yours fails and the script provided provides correct output?

A pull request that fails on AppVeyor would sure be very helpful.

I'll close the issue meanwhile, since otherwise it's not clear how to reproduce the problem and how to fix it. Please feel free to reopen.

@pirj pirj closed this as completed Jan 15, 2020
@JonRowe JonRowe reopened this Jan 15, 2020
@JonRowe
Copy link
Member

JonRowe commented Jan 15, 2020

The problem's pretty clear, Chinese string's being passed in from the command line on windows are not being parsed properly, the issue I, we, have is trying to replicate it to fix it, ideally we need a chinese person to help!

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

4 participants