首页 > 解决方案 > Spring REST Docs:非英文字符串在自定义片段表列中不起作用

问题描述

我为 response-fields.adoc 定义了一个自定义片段模板,以包含一个附加列,在该列中我使用中文字符作为该新列的名称。问题是生成的代码段没有以正确的中文字符显示列名,尽管列中的数据以中文正确显示。

我的 response-fields.snippet 文件以 UTF-8 编码。

这是我的自定义代码段模板:

|===
|Field|Type|Description|中文描述

{{#fields}}
|{{path}}
|{{type}}
|{{description}}
|{{description_zh_tw}}

{{/fields}}
|===

预期生成的片段:

|===
|Field|Type|Description|中文描述

|responseStatus
|String
|ID of the team.
|測試

|infected
|String
|ID of the team.
|測試

|fileName
|String
|ID of the team.
|測試

|===

实际生成的片段:

|===
|Field|Type|Description|銝剜��膩        <==== encoding problem?

|responseStatus
|String
|ID of the team.
|測試

|infected
|String
|ID of the team.
|測試

|fileName
|String
|ID of the team.
|測試

|===

标签: asciidocspring-restdocs

解决方案


将代码段模板的编码从UTF-8更改为Big5可解决问题。


推荐阅读