How Character Encoding Works on Juniper Networks Devices
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, the software escapes and encodes these characters. The software escapes or encodes the characters using the equivalent UTF-8 decimal character reference.
The CLI attempts to display any non-ASCII characters in configuration data that is produced in text, set, or JSON format. The CLI also attempts to display these characters in command output that is produced in text format. In the exception cases, the CLI displays the UTF-8 decimal character reference instead. (Exception cases include configuration data in XML format and command output in XML or JSON format,) In NETCONF and Junos XML protocol sessions, you see a similar result if you request configuration data or command output that contains non-ASCII characters. In this case, 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.
[edit] user@host# set system login user mariap class super-user uid 2007 full-name "Maria Peña"
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, the ñ character
maps to its equivalent UTF-8 decimal character reference
ñ
. The same result occurs if you display the
configuration in any format in a NETCONF or Junos XML protocol session.
[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, you can load non-ASCII characters using their equivalent UTF-8 decimal character references.