1

I have a dictionary entry whose phrase value solely consists of a single pipe symbol. The item gets serialized just fine. But when I synchronize it, the phrase value of the created dictionary entry is empty.

I was able to replicate the same behavior with content items. It's therefore not specific to dictionary entries.

I noted the pipe symbol is a special character in yaml files that preserves line breaks. So I tried using another special character, namely the >, which folds new lines. The item got synchronized without a problem and a single > appeared in the field. Hence it doesn't seem to be related to special characters in yaml files in general.

Additionally I happened to notice that the value of some items like __Created by start with a single pipe symbol followed by a line break and the actual value on a new line. For example:

- ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
  Hint: __Created by
  Value: |
    sitecore\admin

In Sitecore the value of the field after synchronisation still only contains the sitecore\admin and no |. Accordingly a single pipe symbol on a line seems to get special treatment.

In the meantime I'm using a symbol that looks almost like a pipe. But I wonder if there is another solution to this and if this is supposed or tolerated behavior.

Update

Following the comment below I tried to manually replace the vaule similar to the __Created by field. After synchronizing it the value of the phrase field was a single pipe as expected. I then changed the key value to see how the item gets serialized. Serialization of course led again to a single pipe symbol in the yaml file. Lastly I changed the key value back to it's original value and to my surprise the phrase value in the yaml file was now empty. I tried the same procedure with a simple single line field of a content item and could replicate it. Using the unicorn control panel to reserialize didn't raise the issue.

Another interesting observation I made: Using a single pipe followed by a blank space works just as it should and none of the aformentioned problems occur.

Even though workarounds exist this doesn't seem to be desirable behavior. It would be great if someone could clarify why this happens.

To summarize up the issue:

  • I have a field with a single pipe symbol as a value.
  • Serializing it for the first time creates a correct yaml file.
  • Serializing it again through changing some other value of the item results in an empty value instead of the pipe in the yaml file.
  • Synchronizing the correct yaml file results in an empty field in Sitecore.
  • Have you tried escaping? What happens if you manually replace the Value: to be similar to that of the __created by field? However instead of 'sitecore\admin' you get put your | symbol as the value? Also try the > than sign to escape instead of the pipe above. Then see if that serializes ? – Anicho Feb 6 at 15:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.