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