Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird unicode issue in Container#logs() output #79

Closed
kfatehi opened this issue Aug 1, 2014 · 9 comments
Closed

Weird unicode issue in Container#logs() output #79

kfatehi opened this issue Aug 1, 2014 · 9 comments
Labels

Comments

@kfatehi
Copy link

kfatehi commented Aug 1, 2014

Hi, first of all thanks for this module! Second, I have a strange issue / question but I'm not sure if it's a Docker thing or a dockerode thing. Please see moby/moby#7375

@apocas
Copy link
Owner

apocas commented Aug 2, 2014

Thanks!
It's normal in ansi terminal output :)

Had to solve that same problem in nodechecker.com stdout and stderr outputs.

Check this out:
https://github.com/apocas/nodechecker.com/blob/master/public/js/views/module.js#L15
https://github.com/drudru/ansi_up (great lib to convert ansi to formatted html, if you need it)

EDIT:
Just read details...
Humm that seems an encoding issue somewhere. Not the usual ansi formatting issue.
Can't remember if I ever encountered something like that.

@apocas apocas added the question label Aug 2, 2014
@kfatehi
Copy link
Author

kfatehi commented Aug 3, 2014

Thank you -- I ended up doing a regex whitelist against the output -- which still sucks but at least it's readable and doesn't destroy the terminal:

var patt = /([0-9a-zA-Z'"#,\-/_ .@]+)/;
stream.on('data', function (chunk) {
  var str = chunk.toString('utf-8');
  var match = str.match(patt);
  if (match) {
    console.log(match[0])
  }
});

@apocas
Copy link
Owner

apocas commented Aug 5, 2014

Will close this for now.
If we find it's source and if it's related with dockerode then it will be tackled :)

@apocas apocas closed this as completed Aug 5, 2014
@kfatehi
Copy link
Author

kfatehi commented Aug 7, 2014

@apocas please see moby/moby#7375 (comment) should this be handled by dockerode, or my downstream application ?

@apocas
Copy link
Owner

apocas commented Aug 7, 2014

Humm. Dockerode already tackles this and "demuxes" the streams for you if you want.
Now i think you probably are just not attaching correctly or forgot to demux the stream.

Check this attach scenario in here: https://github.com/apocas/nodechecker-tester/blob/master/lib/container.js#L120

Are you attaching and demuxing like this?

@kfatehi
Copy link
Author

kfatehi commented Aug 7, 2014

Ah so I need to use that -- sweet deal thanks @apocas

@apocas
Copy link
Owner

apocas commented Aug 7, 2014

No problem. Sorry for not figuring out what was happening faster, I thought you were already demuxing :)

@kfatehi
Copy link
Author

kfatehi commented Aug 7, 2014

All good man thanks for building this BADASS library :)

@benjick
Copy link

benjick commented Sep 14, 2023

Is there any suggested solution for this? The solution by @kfatehi works but it still shows some weird chars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants