cmd returns strings with different encodings in some cases
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 57
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am using the Net::Telnet gem to connect to remove servers, most of the times, the returned string by the cmd method has UTF-8 encoding, but the other day, one of the outputs from the server returned the character "ñ" and when the character is present in the output the encoding from the string is BINARY, I could not figure out where this change in the encoding is happening and why
Example:
client = Net::Telnet.new('Host' => "192.168.1.2", 'Port' => 23, 'Prompt' => //, 'Waittime' => 0.5, 'Timeout' => 30)
result_1 = client.cmd("test 1") # command does not return ñ
result_1.encoding -> #<Encoding:UTF-8>
result_2 = client.cmd("test 2") # command does return ñ
result_2.encoding -> #<Encoding:BINARY>
Version
ruby 3.2.0
net-telnet 0.2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the encoding difference with the Net::Telnet#cmd examples in the issue, then trace where cmd receives and returns server output. Done means the behavior is understood and cmd returns a consistent, documented encoding for output containing non-ASCII characters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100