switching to extended character set using curses & perl

Discussion in 'Perl Misc' started by someone92@hotmail.com, Jan 19, 2005.

  1. Guest

    Hi,
    I'm writing a perl program that needs to draw lines and other special
    characters on the screen. I'm using curses to design my user interface.
    I'm been trying for a while to figure out how to change to the extended
    character set using curses without any success. I'm using FreeBSD 4.10
    (VT320 terminal)

    I'm able to switch to ecs without curses this way
    print ("\e(0");
    print ("qqqqq"); #works really draw a line

    but if I try to print an escape sequence using curses's addstr it will
    be printed on screen, so it doesn't work. And it seems that perl's
    curses module doesn't support addrawch (which could have been useful)

    I also tried what I thought was the solution to my problem but I was
    really suprised that it doesn't work :

    Curses::initscr;
    Curses::attrset(A_ALTCHARSET);
    $c="qqqqqqqqqqq";
    Curses::addstr ($c);
    Curses::refresh;
    Curses::endwin;

    Curses doesn't seems to switch to ecs

    I found this quotes on the newsgroups:
    "The attrset(A_ALTCHARSET) will use terminfo capabilties to switch to
    the alternate character set. To use this successfully, the terminfo
    entry for your terminal must define 'smacs' (start alternate character
    set), 'rmacs' (end alternate character set) capabilities. In addition,
    the 'sgr' capability definition should implement the '%9' flag for
    alternate character set."

    is it true? I only found /etc/termcap on my FreeBSD system and nothing
    about smacs and rmacs in it.

    Anyone can help me ? thanks in advance
     
    , Jan 19, 2005
    #1
    1. Advertising

  2. Guest

    I'm sorry I think I ment alternate character set not extended character
    set. I also tried to modify my /etc/termcap file for each terminals I
    use(vt320 & xterm) by adding this in the corresponding sections:

    :as=^N:ae=^O:aE=\E(B\E)0:ac=``aaffggjjkkllmmnnooppqqrr
    ssttuuvvwwxxyyzz{{||}}~~..--++ ,,hhII00:

    But still curses doesn't switch to alternate character set. Should I do
    something special to update the /etc/termcap.db database ? if I use
    "tset -S" I see that one of my terminal already have the as,ae,ac,aE
    settings configured (vt320), my xterm (from putty) terminal's settings
    are not updated when I change /etc/termcap

    If someone has another solution than updating the termcap info and
    still using curses that would be better since if I distribute the code
    I don't want the users to have to mess with termcap.

    Thanks
     
    , Jan 20, 2005
    #2
    1. Advertising

  3. Guest

    I finally found a way to print an alternate character on screen with
    perl & curses:

    my $char=&Curses::ACS_LTEE;
    $win->move($dy,$dx);
    $win->hline($char,1);
    But it's not very nice, I'm sure there's a better way to do this.
     
    , Jan 20, 2005
    #3
  4. Guest

    I found the solution to my problem just in case someone would need the
    information some day:

    Curses::attrset(&Curses::A_ALTCHARSET); #switch to ACS
    $win->addstr($y,$x,$ACSchar);
     
    , Jan 25, 2005
    #4
  5. Guest

    I found the solution to my problem just in case someone would need the
    information some day:

    Curses::attrset(&Curses::A_ALTCHARSET); #switch to ACS
    $win->addstr($y,$x,$ACSchar);
     
    , Jan 25, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    807
    Catalin Pitis
    Oct 21, 2004
  2. Guest
    Replies:
    1
    Views:
    477
    Ron Natalie
    Oct 21, 2004
  3. Jean-Paul Calderone
    Replies:
    2
    Views:
    439
    Joel Hedlund
    Feb 9, 2006
  4. Replies:
    3
    Views:
    274
    Fulvio
    Apr 9, 2006
  5. Simon Harris

    Extended Character Set - CDONTS

    Simon Harris, Feb 9, 2004, in forum: ASP General
    Replies:
    0
    Views:
    130
    Simon Harris
    Feb 9, 2004
Loading...

Share This Page