Skip to main content

Escaping characters

There are some characters that developers are well accustomed to having to escape. They vary by programming environment, but often include any one of these characters: " ' , { } * < \ / etc.

Escaping in metadata

Other than escaping enclosing quote characters (with \), there's not much to do.

{
id: 'button',
type: 'action',
component: 'Button',
content: {
id: 'myapp.mycomponent.someID',
defaultMessage: ' \' < $ 😀 \ " { }', // All safe
},
}

Escaping in JS

This is more problematic.

As of Jutro v5.0, characters are escaped by wrapping with apostrophes. Examples:

defaultMessage = " 1 '<' 3" // 1 < 3

defaultMessage = " Escaping an argument '{foo}'" // {foo}

defaultMessage = "'{'" // {