Coder Social home page Coder Social logo

Unicode support? about pancurses HOT 7 OPEN

saethlin avatar saethlin commented on June 30, 2024
Unicode support?

from pancurses.

Comments (7)

saethlin avatar saethlin commented on June 30, 2024 4

I added features = ["wide"] to my Cargo.toml, and unicode output works now!
Is there still work to be done? If this feature is incomplete or something I'm interested in helping out.

from pancurses.

ihalila avatar ihalila commented on June 30, 2024

Could you elaborate on what you mean exactly? At least on Windows unicode output works as far as I know, aside from some special cases, and input should as well for both platforms with the release of v0.15. Output with ncurses may require more work, I haven't looked into it for a while.

from pancurses.

saethlin avatar saethlin commented on June 30, 2024

I'm looking at a problem with unicode output on linux.

I think all one would need is to insert this call after the initscr() call, but I'm a bit hesitant to suggest just making everyone en-US locale.
https://github.com/jeaye/ncurses-rs/blob/85ab2aa9d58eb58ba68cbac47f105cc93cf36aae/examples/ex_7.rs#L19

from pancurses.

ihalila avatar ihalila commented on June 30, 2024

setlocale is already called in

setlocale(LcCategory::all, "");
, so that's not the problem.

I did some testing and Unicode output works as it should for me as long as I have the ncurses/wide feature enabled (exported as just wide in pancurses) and I don't use addch, because that doesn't work correctly. Checking the ncurses manual at http://invisible-island.net/ncurses/man/curs_addch.3x.html it has two relevant bullet points:

  • check if a character can be represented as a single byte in the current locale before attempting call waddch, and
  • call wadd_wch for characters which cannot be handled by waddch.

which leads me to believe that pancurses should really always use wadd_wch, it would probably work correctly. Unfortunately ncurses-rs does not expose that function yet so fixing this requires a change there first.

from pancurses.

ihalila avatar ihalila commented on June 30, 2024

The only issue I know of is the one I described in my earlier comment, regarding addch() not working for multibyte characters.

from pancurses.

TimonPost avatar TimonPost commented on June 30, 2024

There is one other problem as described here:

#43 (comment)

We can't use Unicode on a terminal created with pancurses::newterm. In order to support this platform_specific::pre_init() should be added to that function as well.

from pancurses.

plefebvre91 avatar plefebvre91 commented on June 30, 2024

Is there any solution today ?

from pancurses.

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.