Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

windows上cli 处理文件编码问题

Open
#61 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java

Research direction

Reproduce the java -jar ... checkstyle command in Windows cmd with the UTF-8 openapi.yml, first comparing behavior with and without -Dfile.encoding=UTF-8. Trace the failure from ToolkitMain.main into CheckStyleBase.run; done means the CLI processes Chinese UTF-8 input without requiring the JVM encoding flag.

Written by the indexing model from the issue text.

Description

openapi yaml 文件有中文字符,文件编码格式是 utf-8 。当在windows cmd 下执行时会提示编码错误,需要加上 -Dfile.encoding=UTF-8。

错误信息如下:

`java -jar bin/cli-0.2.0-SNAPSHOT.jar checkstyle -r style-check-rules.properties -f openapi.yml
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.RuntimeException: java.io.CharConversionException: Invalid UTF-8 start byte 0xb5 (at char #35, byte #-1)
 at [Source: (byte[])"openapi: '3.0.2'
info:
  title: ?????POS???
  version: '1.0.0'
  description: ???POS???????
servers:
  - url: 'https://xxxxxxxx'
    description: ???????????????
  - url: http://xxxxxxxxxx/{basePath}
    description: ?????????????
    variables:
      basePath:
        default: v2
        description: api version


paths:
  /pos/login.init:
    $ref: commonapi.yml#/components/login.init
  /pos/login:
    $ref: commonapi.yml#/compo"[truncated 1336 bytes]; line: 1, column: 1]
        at org.apache.servicecomb.toolkit.cli.CheckStyleBase.run(CheckStyleBase.java:84)
        at org.apache.servicecomb.toolkit.cli.ToolkitMain.main(ToolkitMain.java:48)
        ... 8 more
make: *** [Makefile:28: verify] Error 1`
Dominant language
Java
Stars
440
Forks
35
Avg merge
1m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/servicecomb-toolkit

All issues in apache/servicecomb-toolkit

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.