# If hugo have some chinese attributes for asciidoctor, asciidoctor throw error #4351

**URL:** <https://discourse.gohugo.io/t/if-hugo-have-some-chinese-attributes-for-asciidoctor-asciidoctor-throw-error-4351/40441>\
**Category:** support\
**Tags:** asciidoc\
**Created:** [September 9, 2022, 3:15am UTC](https://discourse.gohugo.io/t/if-hugo-have-some-chinese-attributes-for-asciidoctor-asciidoctor-throw-error-4351/40441 "2022-09-09T03:15:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 3:15am UTC](https://discourse.gohugo.io/t/if-hugo-have-some-chinese-attributes-for-asciidoctor-asciidoctor-throw-error-4351/40441/1 "2022-09-09T03:15:25Z")

</div>

Please see this reference [If hugo have some chinese attributes for asciidoctor, asciidoctor throw error · Issue #4351 · asciidoctor/asciidoctor · GitHub](https://github.com/asciidoctor/asciidoctor/issues/4351)

Hugo passes a Chinese string instead of a UTF\_8 string, which causes the problem.

But if hugo use node\_modules/.bin/asciidoctor, no problem occurred

I fixed by modify asciidoctor source code, but hugo can parse utf\_8 to asciidoctor is better

---

<div class="post-metadata">

**Author:** ![zkaip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/zkaip/32/17700_2.png) [@zkaip](https://discourse.gohugo.io/u/zkaip)\
**Post date:** [September 9, 2022, 10:16am UTC](https://discourse.gohugo.io/t/if-hugo-have-some-chinese-attributes-for-asciidoctor-asciidoctor-throw-error-4351/40441/2 "2022-09-09T10:16:12Z")

</div>

> <https://github.com/asciidoctor/asciidoctor/issues/4351>
>
> if hugo have markup attribute like the follow
> \<img width="360" alt="Screen Shot… 2022-09-08 at 17 38 28" src="https://user-images.githubusercontent.com/705088/189093944-6c540d15-2760-4934-84df-c9d22e00cf02.png"\>
> 
> The error is happened as follow
> \<img width="600" alt="Screen Shot 2022-09-08 at 17 19 50" src="https://user-images.githubusercontent.com/705088/189094193-52aa5f3a-4dfa-41c0-99df-f5c83c813915.png"\>
> 
> then I edit \`lib/asciidoctor/cli/options.rb\`
> from 
> \`attr = attr.encode UTF\_8 unless attr.encoding == UTF\_8\`
> \<img width="600" alt="Screen Shot 2022-09-08 at 17 22 12" src="https://user-images.githubusercontent.com/705088/189094618-881381e2-06d0-4efb-abb8-dc90ea5aa2e0.png"\>
> 
> to 
> \`attr = attr.force\_encoding UTF\_8 unless attr.encoding == UTF\_8\`
> \<img width="600" alt="Screen Shot 2022-09-08 at 17 01 54" src="https://user-images.githubusercontent.com/705088/189094743-516e5998-1f68-4d59-aa5f-a149e2bddbe9.png"\>
> 
> the bug is fixed!
> 
> Please reference my fixed to upgrade asciidoctor!

this resolve it

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [September 11, 2022, 10:16am UTC](https://discourse.gohugo.io/t/if-hugo-have-some-chinese-attributes-for-asciidoctor-asciidoctor-throw-error-4351/40441/3 "2022-09-11T10:16:39Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
