Title: fix(run): 启动和调试 Java 程序时默认使用 UTF-8 编码 by AACS111 · Pull Request #21 · Lithe-IDEA/lithe-plugin-java · GitHub
Open Graph Title: fix(run): 启动和调试 Java 程序时默认使用 UTF-8 编码 by AACS111 · Pull Request #21 · Lithe-IDEA/lithe-plugin-java
X Title: fix(run): 启动和调试 Java 程序时默认使用 UTF-8 编码 by AACS111 · Pull Request #21 · Lithe-IDEA/lithe-plugin-java
Description: 关联 Issue / Linked issue 无对应 Issue。问题在 Lithe 0.8.1 + Java Support 2.0.1 上复现,详见下文。 类型 / Type fix:缺陷修复 背景 / Why 在中文 Windows 上用 Java Support 运行或调试 Spring Boot 应用(Java 17)时,应用启动失败: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1 ... Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'serve.system' in value "${serve.system}" 控制台中文 banner 和日志也是乱码。同一项目在 IntelliJ IDEA 中正常启动。 根因:Java 18 之前,JVM 用平台字符集读取文本,中文 Windows 上是 GBK。插件启动 JVM 时没有指定编码,Spring 从配置中心拉到的 UTF-8 YAML 被按 GBK 解析失败,配置缺失导致启动失败。IntelliJ IDEA 在启动时会固定 -Dfile.encoding=UTF-8,所以那边正常。Lithe 的运行窗口按 UTF-8 解码进程输出,控制台流也需要固定 UTF-8。 改动 / Changes backend/src/run.rs 新增 with_utf8_encoding:在每次运行、调试和测试启动的参数最前面加入 -Dfile.encoding=UTF-8、-Dsun.stdout.encoding=UTF-8、-Dsun.stderr.encoding=UTF-8。 启动参数里已经设置的同名属性不再重复添加,保留用户的选择。 在 start 中对主类和测试两种启动统一应用;调试时 JDWP agent 仍排在最前。 新增两个单元测试:参数顺序在主类之前;已设置的编码属性被保留。 对 Java 18 及以上版本这些值与默认一致,不改变行为;不限于 Windows,因为宿主运行窗口在所有平台都按 UTF-8 解码输出。 验证 / Verification 命令 平台 结果 cargo test -p lithe-java-backend --lib run:: Windows 11 x64 21 passed(含 2 个新测试) 同一补丁应用到 v2.0.1 并构建 lithe-java-backend,替换本机 2.0.1 插件后端 Windows 11 x64 构建成功;启动 Spring 应用的端到端验证待补 未能执行:端到端验证(用修复后的后端启动 Spring Boot 应用、确认不再出现 MalformedInputException)还没有完成,完成后在本 PR 补充结果。macOS / Linux 未运行。 🤖 Generated with Claude Code
Open Graph Description: 关联 Issue / Linked issue 无对应 Issue。问题在 Lithe 0.8.1 + Java Support 2.0.1 上复现,详见下文。 类型 / Type fix:缺陷修复 背景 / Why 在中文 Windows 上用 Java Support 运行或调试 Spring Boot 应用(Java 17)时,应用启动失败: org.yaml.snakeyaml.er...
X Description: 关联 Issue / Linked issue 无对应 Issue。问题在 Lithe 0.8.1 + Java Support 2.0.1 上复现,详见下文。 类型 / Type fix:缺陷修复 背景 / Why 在中文 Windows 上用 Java Support 运行或调试 Spring Boot 应用(Java 17)时,应用启动失败: org.yaml.snakeyaml.er...
Opengraph URL: https://github.com/Lithe-IDEA/lithe-plugin-java/pull/21
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a0ef80de-e22e-e9f8-cb92-3d07ab21b6c9 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DE98:119623:9B4EA6:D565EE:6B071373 |
| html-safe-nonce | cbb533a16fe0c8d238b65f539c2042f4d074c9bc3616665f091c7cabd03bf26f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTk4OjExOTYyMzo5QjRFQTY6RDU2NUVFOjZCMDcxMzczIiwidmlzaXRvcl9pZCI6IjU4MTQzMTgyNTM3MDI4NDUyOTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5c2471fea55b66a158ddf893ca7358e7c67d2b2c8c9b4de91c1666bbb3dbbf19 |
| hovercard-subject-tag | pull_request:5348942078 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/Lithe-IDEA/lithe-plugin-java/pull/21/files |
| twitter:image | https://avatars.githubusercontent.com/u/103710223?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/103710223?s=400&v=4 |
| og:image:alt | 关联 Issue / Linked issue 无对应 Issue。问题在 Lithe 0.8.1 + Java Support 2.0.1 上复现,详见下文。 类型 / Type fix:缺陷修复 背景 / Why 在中文 Windows 上用 Java Support 运行或调试 Spring Boot 应用(Java 17)时,应用启动失败: org.yaml.snakeyaml.er... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9aaa1abe1aaef39a8543ab08df7a776c3243275815d741d29afa7b02148ca05e |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/Lithe-IDEA/lithe-plugin-java git https://github.com/Lithe-IDEA/lithe-plugin-java.git |
| octolytics-dimension-user_id | 340144206 |
| octolytics-dimension-user_login | Lithe-IDEA |
| octolytics-dimension-repository_id | 1446370282 |
| octolytics-dimension-repository_nwo | Lithe-IDEA/lithe-plugin-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1446370282 |
| octolytics-dimension-repository_network_root_nwo | Lithe-IDEA/lithe-plugin-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c43783771de038e2c401dd343799000e8d1253 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width