Understanding Character Encoding on Devices Running Junos OS
Junos OS configuration data and operational command output might contain non-ASCII characters, which are outside of the 7-bit ASCII character set. When displaying operational or configuration data in certain formats or within a certain type of session, Junos OS escapes and encodes these characters using the equivalent UTF-8 decimal character reference.
The Junos OS command-line interface (CLI) attempts to display any non-ASCII characters in configuration data that is emitted in text, set, or JSON format, and similarly attempts to display these characters in command output that is emitted in text format. In the exception cases, which include configuration data in XML format and command output in XML or JSON format, the Junos OS CLI displays the UTF-8 decimal character reference instead. In NETCONF and Junos XML protocol sessions, if you request configuration data or command output that contains non-ASCII characters, the server returns the equivalent UTF-8 decimal character reference for those characters for all formats.
For example, suppose the following user account, which contains the Latin small letter n with a tilde (ñ), is configured on the device running Junos OS.
When you display the resulting configuration in text format, the CLI prints the corresponding character.
[edit]
user@host# show system login user mariap
full-name "Maria Peña"; uid 2007; class super-user;
When you display the resulting configuration in XML
format in the CLI or display the configuration in any format in a
NETCONF or Junos XML protocol session, the ñ character maps
to its equivalent UTF-8 decimal character reference ñ
.
[edit] user@host# show system login user mariap | display xml <rpc-reply xmlns:junos="http://xml.juniper.net/junos/17.2R1/junos"> <configuration junos:changed-seconds="1494033077" junos:changed-localtime="2017-05-05 18:11:17 PDT"> <system> <login> <user> <name>mariap</name> <full-name>Maria Peña</full-name> <uid>2007</uid> <class>super-user</class> </user> </login> </system> </configuration> <cli> <banner>[edit]</banner> </cli> </rpc-reply>
When you load configuration data onto a device running Junos OS, you can load non-ASCII characters using their equivalent UTF-8 decimal character reference.