netdev icon indicating copy to clipboard operation
netdev copied to clipboard

Encoding Problem

Open waqasraz opened this issue 7 years ago • 4 comments

I think the issue I open for async ssh fits here because #I am using this to fetch the output.

https://github.com/ronf/asyncssh/issues/154

waqasraz avatar Jul 05 '18 10:07 waqasraz

I need some help with this issue, please if anyone has any idea.

waqasraz avatar Jul 07 '18 10:07 waqasraz

Hello! No problem! I will try to help! Can you provide information about your Juniper router? Version? Model? I find out that we recognize the place where you have a problem. Did you try to change comment? Maybe repeat to type 'n' again? Maybe this 'n' letter not from english by mistake?

selfuryon avatar Jul 08 '18 17:07 selfuryon

Hi, Thank you, Actually, I was able to have some idea about the problem. In some of the routers, engineers added some Unicode characters in the descriptions. So when we try to decode it using UTF-8 it just gets the decode error. Thank you for the good work in the library.

Just on a side note

https://github.com/selfuryon/netdev/blob/e3dd7c9148a1f13d32dc3125414e882c7c41d1ee/netdev/vendors/junos_like.py#L46

this pattern returns partial juniper output as I've tested show configurations on many routers. This one works fine

_pattern = r"\w+(\@[\-\w]*)"

waqasraz avatar Jul 08 '18 20:07 waqasraz

@waqasraz we had similiar issue to this and we solved it by using this codecs.register_error('strict', codecs.backslashreplace_errors) https://docs.python.org/2/library/codecs.html

wallies avatar Nov 21 '19 21:11 wallies