selfuryon / netdev

Asynchronous multi-vendor library for interacting with network devices
http://netdev.readthedocs.io/
Apache License 2.0
213 stars 44 forks source link

Encoding Problem #14

Open waqasraz opened 6 years ago

waqasraz commented 6 years ago

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 commented 6 years ago

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

selfuryon commented 6 years ago

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?

waqasraz commented 6 years ago

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]*)"

wallies commented 4 years ago

@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