Yaml with emoji cause error "the stream contains non-printable characters"
See original GitHub issueWhile using vscode + YAML Language support extensions (version 0.3.0), I found that using emojis cause errors :
- VSCode Version:
code --version
1.31.1
1b8e8302e405050205e69b59abb3559592bb9e60
x64
- OS Version:
cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
...
UBUNTU_CODENAME=bionic
Steps to Reproduce:
- Create a test.yml file with this content as this there is no parsing error (extract from a gitlab-ci.yml file) :
stages:
- build
build:
stage: build
before_script:
- echo "hi"
script:
- echo "hi"
- Create a test.yml with the same content but using also some emojis :
stages:
- build
build:
stage: build
before_script:
- echo "📢 - hi - 👷"
script:
- echo "📢 - hi - 👷"
This leads to the following errors :
{
"resource": "/test.yml",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "the stream contains non-printable characters",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}
{
"resource": "/test.yml",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "incomplete explicit mapping pair; a key node is missed",
"startLineNumber": 1,
"startColumn": 7,
"endLineNumber": 2,
"endColumn": 5
}
{
"resource": "/test.yml",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "end of the stream or a document separator is expected",
"startLineNumber": 2,
"startColumn": 3,
"endLineNumber": 4,
"endColumn": 2
}
{
"resource": "/test.yml",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "end of the stream or a document separator is expected",
"startLineNumber": 4,
"startColumn": 6,
"endLineNumber": 5,
"endColumn": 4
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Write special characters to yaml file - java - Stack Overflow
Since it looks like you want to write emoji characters, ... the only issue you have is not recreating it / writing it...
Read more >YAML Ain't Markup Language (YAML™) revision 1.2.2
It uses Unicode printable characters, some of which provide structural information and the rest containing the data itself.
Read more >Changelog for pandoc-2.14.0.1 | Hackage - Haskell.org
Commonmark reader: Fix regression in 2.14 with YAML metdata block parsing, which could cause ... Emoji character sequences no longer cause parsing failures....
Read more >snakeyaml / Changes - Bitbucket
SnakeYAML is normally released twice a year: August and February ... even when it contains non-printable chars (thanks to @Nebu); Update plugin versions....
Read more >Changelog — Python 3.11.1 documentation
gh-99298: Fix an issue that could potentially cause incorrect error ... encoded to UTF-8/strict to avoid encoding errors if it contains surrogate characters...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That explains. vscode-ansible has an old copy of the extension embedded. Unfortunately that project seems to be unmaintained and we could not get them to use vscode-yaml, instead of embedding the language server.
Closing… Tests are merged. vscode-ansible is a separate issue that we have been following up for a while and failing to get a respond.