question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yaml with emoji cause error "the stream contains non-printable characters"

See original GitHub issue

While 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:

  1. 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"
  1. 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:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gorkemcommented, Nov 21, 2020

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.

0reactions
gorkemcommented, Nov 23, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found