2

Question

What is the default character encoding used by most Cisco devices when communicating over the console?

Background

I'm a software developer, writing an application that interfaces with several cisco devices via their console ports (basically, it runs IOS configuration commands and responds to certain feedback--like errors).

My software runs under mac/windows/linux and each OS has it's own default character encoding systems. So I have to be very careful when I send bytes to the console and when I receive bytes from the console. If I don't specify the right character encoding, things break in whacky ways. Like when I "press return" after sending a command, on certain systems, it will "press return" twice, instead of once! Or, when I receive data and try to make sense of it, the program will get confused by the incorrect byte/character conversion.

Summary

If I power on a new (or freshly reset) Cisco 3845 or 2955 and connect via the console and send data/bytes/characters back and forth...
...what encoding will the device use, by default. My suspicion is that it's UTF-8.

3 Answers 3

3

If its american gear, I think I can safely state that it just uses ASCII for its normal text. It probably won't perform any kind of character set checking, so user-defined names could be any character set as long as the individual bytes are valid as far as the device is concerned. If you receive gibberish from a serial connection, the port is configured incorrectly. When I was younger and actually used serial ports on a regular basis I could sometimes recognize the kind of gibberish and identify which setting was wrong.

As for issues with the enter key, the device will use the same character for "enter" whether you are connecting from windows (where newline is \r\n) or unix (\n) or mac (\r), pick one that works right and it should always work. Depending on how you are connecting (Directly to the serial port device or taking control of a terminal application?) there may be settings like "local echo" that causes what you type to be printed on your screen by the terminal application (Most gear echos text for you so turning on local echo will cause all the letters to be duplicated)

1
  • Thanks! You answered my main question and also helped my other issue... by pointing out that the enter key issues are unrelated to character encoding, your comments helped me to figure out that problem: turns out, the api I'm using to handle telnet stuff is appending a '\r' on everything I send it!
    – gMale
    Apr 21, 2011 at 3:38
3

Nothing more complex than just plain old ASCII. I understand UTF-8 is backwards compatible with that so you should be ok with it.

As an aside, I've been down the route of writing programs to control and get reports from various Cisco boxes, I started out using console connections but realised after a fairly short time that it really is not a long term solution, you will end up using SNMP for anything at all complex.

The main reason for this is that the response from the CLI is not always consistent and will almost certainly change between releases of IOS, the second reason is that SNMP, although apparently complex when first viewed, is designed for getting information from network and changing settings, is standard and will always give consistent results. Just my 10p worth.

2
  • funny we're writing an SNMP app, as well. Our SNMP stuff is actually fairly elaborate. I'm curious, can you handle initial configuration of a cisco box via SNMP??? Like can you set the admin password and stuff like that?
    – gMale
    Apr 21, 2011 at 1:20
  • I've not tried, but I doubt it because you have to set up the initial SNMP community codes before you can do anything else. I don't recall ever doing anything much on the user side, my Cisco code has mainly been reporting on the working side of the devices along with various routines to archive configs and change settings required.
    – blankabout
    Apr 21, 2011 at 1:54
0

Disclaimer: I am not a software developer =)

Does the below document help at all? It discusses "character set" in a number of areas - including default values. I'm not quite sure if thats the same as "character encoding", at least in the context in which you're asking.

http://www.cisco.com/en/US/docs/ios/12_1/configfun/command/reference/frd1003.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .