GithubHelp home page GithubHelp logo

encoding on windows about cowsay HOT 19 OPEN

sckott avatar sckott commented on September 2, 2024
encoding on windows

from cowsay.

Comments (19)

leeper avatar leeper commented on September 2, 2024

No solution, but returning a character string and printing with cat works in Rgui but not the console. E.g., cat(say("asdfsf", "longcat", length = 4, type="string")). So clearly Rgui is doing something to unicode character strings that it does not do under message/warning/error and R itself does not do at all.

from cowsay.

sckott avatar sckott commented on September 2, 2024

thanks @leeper - will keep digging

from cowsay.

sckott avatar sckott commented on September 2, 2024

@gavinsimpson any help on the encoding issue on Windows?

from cowsay.

richfitz avatar richfitz commented on September 2, 2024

Sorry, Scott, I don't currently have access to a windows box

from cowsay.

sckott avatar sckott commented on September 2, 2024

meh, maybe we'll just put this on CRAN and say it doesn't work on Windows, seem okay @leeper @richfitz @gavinsimpson

from cowsay.

leeper avatar leeper commented on September 2, 2024

I don't have time at the moment to try to figure it out, so that's fine.
Maybe putting it on CRAN will catch the attention of someone who can make
it work.

On Tue, Nov 4, 2014 at 5:13 AM, Scott Chamberlain [email protected]
wrote:

meh, maybe we'll just put this on CRAN and say it doesn't work on Windows,
seem okay @leeper https://github.com/leeper @richfitz
https://github.com/richfitz @gavinsimpson
https://github.com/gavinsimpson


Reply to this email directly or view it on GitHub
#9 (comment).

from cowsay.

sckott avatar sckott commented on September 2, 2024

Poll:

doesn't work:

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

I think the pertinent information is in here: http://cran.cnr.berkeley.edu/doc/manuals/r-devel/R-ints.html#Encodings-for-CHARSXPs.

Basically it seems like, on Windows, functions which use C code like message and warning can't properly deal with UTF-8 strings due to the Windows C compiler. It looks like cat and print have some sort of escape which gets around this... which is consistent with what @leeper observed (I experienced the same behaviour).

capture

I played around with iconv a bit to no avail. I don't think you can catch and modify a message or warning after it's called and before it's printed?

from cowsay.

sckott avatar sckott commented on September 2, 2024

@ateucher what if you use type="string", then call message(), etc. manually after it comes back? does that work okay?

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

Nope. I think as soon as message/warning get hold of it, it kills it:
capture

from cowsay.

sckott avatar sckott commented on September 2, 2024

okay, boo, well, not sure what to do then.

could just not use unicode characters and use the closest ascii characters...but you've kind of solved this another way by not using those that have unicode on windows

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

Yeah, could do gsub on the \u strings only if os == windows. But I wouldn't want to do it wholesale and make them look worse for everybody else. Some of those might be hard to find decent replacements for though!

from cowsay.

sckott avatar sckott commented on September 2, 2024

i think maybe we should just go with the solution you've already done - and push to CRAN!

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

Agreed! It does function on Windows, so we should go for it.

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

So I guess this isn't really fixed yet - the appveyor build is failing on the examples using non-ascii characters (anxiouscat). Would you want to put those in a dontrun section?

from cowsay.

sckott avatar sckott commented on September 2, 2024

@ateucher it seems like its an issue with the match.arg https://ci.appveyor.com/project/sckott/cowsay/build/1.0.218#L366 or am i looking at it wrong

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

It is, but because on Windows get_who() removes anxiouscat etc from the vector whose names are used in match.arg. That's why they all work on Linux/Mac, but the animals with non-ASCII throw an error on Windows.

from cowsay.

sckott avatar sckott commented on September 2, 2024

I'll just remove the examples that don't work on windows...

from cowsay.

ateucher avatar ateucher commented on September 2, 2024

Yeah, good idea. That's the simplest solution

from cowsay.

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.