2

I am using VS Code 1.24.0 on macOS to edit YAML files that are saved to an NFS share (published on a QNAP NAS) and used by an Ubuntu 18 linux system.

When saving the YAML file VS Code often inserts a bunch of non-printable control characters which causes an error parsing the YAML. To fix it I need to open the file with vim and remove them.

00000110  20 73 65 72 76 65 72 3a  20 4e 41 53 31 0a 20 20  | server: NAS1.  |
00000120  70 65 72 73 69 73 74 65  6e 74 56 6f 6c 75 6d 65  |persistentVolume|
00000130  52 65 63 6c 61 69 6d 50  6f 6c 69 63 79 3a 20 52  |ReclaimPolicy: R|
00000140  65 74 61 69 6e 00 00 00  00 00 00 00 00 00 00 00  |etain...........|
00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000270  00 00 00 00 00 00 00 00  00 00 00 00 00           |.............|
0000027d

Note 1: It never happens if I use VS Code on the linux system and edit the files locally; but I need to use this as a headless server so this is not how I want to work.

Note 2: This appears to be a similar issue to that raised here some time ago - but no solution is available.

Bryon
  • 939
  • 13
  • 25
  • What *non-printable control characters* specifically are being inserted? – Ken White Oct 11 '18 at 00:08
  • I have not worked that out, but vim shows them as a set of “@“ (at) characters. Sometimes there are over a hundred. – Bryon Oct 11 '18 at 01:03
  • Open the YAML file in a hex editor or viewer and see what the characters are - that information would be useful. – Ken White Oct 11 '18 at 01:07
  • They are nulls. Here is a hexdump; the last word in the yaml file is Retain (n = 0x63) 0000130 6552 6c63 6961 506d 6c6f 6369 3a79 5220 0000140 7465 6961 006e 0000 0000 0000 0000 0000 0000150 0000 0000 0000 0000 0000 0000 0000 0000 – Bryon Oct 11 '18 at 02:00
  • Can you [edit] that information into your question, so you can properly format the hex dump so that it's readable? – Ken White Oct 11 '18 at 02:13
  • I have updated the original post. – Bryon Oct 11 '18 at 02:25
  • This is not normal VS Code behaviour. There is something involved that is not in the question. Perhaps if the question is obsolete or invalid, it could be deleted. – Marko Kohtala May 12 '20 at 06:27

0 Answers0