# Re: snmp error

**URL:** <https://www.ruby-forum.com/t/re-snmp-error/107930>\
**Category:** Ruby\
**Created:** [June 27, 2007, 5:31pm UTC](https://www.ruby-forum.com/t/re-snmp-error/107930 "2007-06-27T17:31:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [June 27, 2007, 5:31pm UTC](https://www.ruby-forum.com/t/re-snmp-error/107930/1 "2007-06-27T17:31:19Z")

</div>

> the mac address is visualized as shown
> 
> 1.3.6.1.2.1.2.2.1.6.1 ÃƒÂ½g OCTET STRING
> 
> instead of 0:10:83:fd:dd:67.
> 
> How can I fix it?

The trouble is that you are printing the raw 6 byte string (note that  
hex 67  
is the ASCII code for a lower-case ‘g’)

So you just need to convert it into 12 hex digits:

```
a = "\x00\x10\x83\xfd\xdd\x67"
puts a.unpack("H*").first

```

Here’s one way to add the colons:

```
a = "\x00\x10\x83\xfd\xdd\x67"
puts a.unpack("H2H2H2H2H2H2").join(":")
```
