You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "David Leangen (OSGi)" <os...@leangen.net> on 2022/09/15 07:46:17 UTC

Setting the Gogo shell to UTF-8?

Hi!

I am having trouble using UTF-8 characters with the Gogo Shell.

I have implemented a command “register” that takes a string argument. I try to run it like this:

g! register 何か漢字で書いてる言葉

The string gets parsed as "何か漢字で書いてる言葉” instead of “何か漢字で書いてる言葉”. Not even sure what encoding that is.

I checked the stack trace in debug mode to ensure it wasn’t my code. It seems to me that from the moment the text is input into the shell it gets interpreted that way (all the way up the stack trace).

I tried echo as well:


```
g! echo こんにちは
こんにちは
```


I already checked out a few threads and tried those fixes, but no luck:

 * https://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding/623036
 * https://stackoverflow.com/questions/8920712/osgi-bundle-doesnt-display-utf-8-characters


I updated my gogo shell to the latest available version on Maven Central.


Any other ideas about how I could resolve this issue?


Thanks!
=David



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Setting the Gogo shell to UTF-8?

Posted by "David Leangen (OSGi)" <os...@leangen.net>.
Hey, thanks Raymond.

> If I had to guess it would have to do with processing pure bytes without
> considering encoding and hence multi-byte characters.
> 
> I'd be willing to guess that's a fundamental implementation flaw
> potentially down to the telnet protocol itself.

Hmmmm. In that case, sounds like I'll just have to deal with it somehow.

Based on your theory, do you have an idea about how I could potentially re-encode a string? Even if there is an issue with encoding, so long as whatever happens is not lossy, I should be able to "get back" my characters, no?

Or, any other ideas for a workaround? The only thing I can think of right now is writing the arguments to a file. I don't have encoding problems with file I/O, only when I use stdin.

Cheers,
=David

Re: Setting the Gogo shell to UTF-8?

Posted by Raymond Augé <ra...@liferay.com.INVALID>.
If I had to guess it would have to do with processing pure bytes without
considering encoding and hence multi-byte characters.

I'd be willing to guess that's a fundamental implementation flaw
potentially down to the telnet protocol itself.

:(


On Thu, Sep 15, 2022 at 3:46 AM David Leangen (OSGi) <os...@leangen.net>
wrote:

> Hi!
>
> I am having trouble using UTF-8 characters with the Gogo Shell.
>
> I have implemented a command “register” that takes a string argument. I
> try to run it like this:
>
> g! register 何か漢字で書いてる言葉
>
> The string gets parsed as "何㠋漢字㠧書㠄㠦る言葉” instead of
> “何か漢字で書いてる言葉”. Not even sure what encoding that is.
>
> I checked the stack trace in debug mode to ensure it wasn’t my code. It
> seems to me that from the moment the text is input into the shell it gets
> interpreted that way (all the way up the stack trace).
>
> I tried echo as well:
>
>
> ```
> g! echo こんにちは
> ã “ã‚“ã «ã ¡ã ¯
> ```
>
>
> I already checked out a few threads and tried those fixes, but no luck:
>
>  *
> https://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding/623036
>  *
> https://stackoverflow.com/questions/8920712/osgi-bundle-doesnt-display-utf-8-characters
>
>
> I updated my gogo shell to the latest available version on Maven Central.
>
>
> Any other ideas about how I could resolve this issue?
>
>
> Thanks!
> =David
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

-- 
*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow, Java Champion