Giter Club home page Giter Club logo

Comments (7)

princjef avatar princjef commented on July 3, 2024 1

No worries, thanks for checking it and reporting back!

I honestly wasn't aware of the Powershell encoding quirk either, so I'm glad you reported the strangeness. I'll get the docs updated so people don't have the same issue in the future

from gomarkdoc.

MarvinJWendt avatar MarvinJWendt commented on July 3, 2024

This happens when I show the file with cat:
image

from gomarkdoc.

princjef avatar princjef commented on July 3, 2024

Thanks for the report! I found the file in the repo (linking here so i can quickly refer back): https://github.com/pterm/pterm/blob/9d43bad55166341b6349c3c93cc2e764051d9de6/bigtext_printer.go#L135

I'm betting it's an issue with the escaping logic. Let me work up a test case to see if I can find the problem here

from gomarkdoc.

princjef avatar princjef commented on July 3, 2024

I created some tests but they appear to be producing the output correctly. I tried cloning pterm and running gomarkdoc . on it. The output seems to be correct to me: https://gist.github.com/princjef/ba9265239132c477e438cabd55431186

Can you share some more information about how you're configuring/running gomarkdoc? That might help us get to the bottom of this.

from gomarkdoc.

MarvinJWendt avatar MarvinJWendt commented on July 3, 2024

Hi @princjef, thanks for the reply. I just tried it again, with a new clone of PTerm and I still get the wrong characters when I run gomarkdoc . > test.md.

I don't have any custom configuration.

IntelliJ IDEA tells me, that the output file is written in UTF-16LE encoding. I think, this might be the problem? I am using Windows 10 with PowerShell.

from gomarkdoc.

princjef avatar princjef commented on July 3, 2024

@MarvinJWendt ahh okay I think Powershell is the key detail here. I don't have a Windows machine handy to test, but it looks like when piping output, Powershell defaults the encoding to UTF16: https://automationpie.com/changing-powershells-default-output-encoding-to-utf-8/

From what I'm seeing, it doesn't look like there's any way for me to signal the encoding from the gomarkdoc executable itself to override that behavior. I think there are two options:

  1. Change the encoding in your Powershell settings as described in the linked page so that data is passed in UTF-8 encoding.
  2. Use the --output option so that gomarkdoc bypasses Powershell's piping and writes the file directly. This should provide the right encoding for your output file: gomarkdoc --output test.md .

I'd be curious to see if option 2 works for you. If it does, then it may make sense to update the examples to use --output so that people get more consistent cross-platform behavior out of the box.

from gomarkdoc.

MarvinJWendt avatar MarvinJWendt commented on July 3, 2024

Hi @princjef, sorry for the late reply. Yes the output flag seems to work!

And the pipe seems to be the problem. Even as a long time Windows user I never experienced this.
I wrote a sample file, with the chars that where producing the weird behaviour, and piped it into another file. And look at that, the error occurs. So it might be the best to update the example :)

Have a nice day and thanks for the research :)

from gomarkdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.