1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Textutils request

Discussion in 'Plugins' started by dcantor, Jan 31, 2017.

  1. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    Charles Dye,

    Would you consider providing a way for @UQUOTES and WRAP to suppress replacing a double hyphen with an em dash?
    Perhaps supply an environment variable which is the string that replaces the double hyphen, default to the em dash. I would set it a single hyphen for my purposes.


    Tnx,
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    I'm reviewing the source and it looks like you've already got it; set a variable EMDASH to the character (not string) you want. You can specify it either as a literal character, or as a decimal or hexadecimal value.

    Dunno how I managed to document the obscure ones, and miss that....
     
  3. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    Thanks, Charles, but it doesn't work.

    I just tried using
    set emdash=0x002D
    and it does not work. The actual emdash character 0x0097 appears in the output where two occurrences of 0x002D appear in the input.

    I also tried setting EMDASH to 0x2D and a literal hyphen, and none worked.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Can you give an example?
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    Isn't emdash 0xA158?
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
     
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    Charmap says

    upload_2017-1-31_17-31-5.png

    Exactly what does that mean?
     
  8. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Okay, I see it now. Bug affecting WRAP only; I've uploaded a fix.
     
  9. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    I downloaded the new version.

    WRAP now works correctly:
    Code:
    ~\Work> unset emdash
    
    ~\Work> echo abcde--fgh > x.tmp
    
    ~\Work> WRAP /f:2 /c:1 /P:2,2 /W:69 /Q x.tmp > y.tmp
    
    ~\Work> set emdash=0x2D
    
    ~\Work> WRAP /f:2 /c:1 /P:2,2 /W:69 /Q x.tmp > z.tmp
    
    ~\Work> type /x y.tmp
    0000 0000 20 20 61 62 63 64 65 97  66 67 68 0d 0a             abcde—fgh..
    
    ~\Work> type /x z.tmp
    0000 0000 20 20 61 62 63 64 65 2d  66 67 68 0d 0a             abcde-fgh..
    
    But, @UQUOTES still fails:
    Code:
    ~\Work> unset  emdash
    
    ~\Work> echo %@uquotes[zyxwv--uts] > y.txt
    
    ~\Work> set emdash=0x2D
    
    ~\Work> echo %@uquotes[zyxwv--uts] > z.txt
    
    ~\Work> type /x y.txt
    0000 0000 7a 79 78 77 76 97 75 74  73 0d 0a                 zyxwv—uts..
    
    ~\Work> type /x z.txt
    0000 0000 7a 79 78 77 76 97 75 74  73 0d 0a                 zyxwv—uts..
    
    I'm happy, because I'm using WRAP, and @UQUOTES isn't affecting me right now.
    Thanks, Charles
     
    #9 dcantor, Jan 31, 2017
    Last edited: Jan 31, 2017
  10. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    That Charmap is set to the Traditional Chinese code page?
     
  11. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    OK, I get it. (Doh!). So the emdash is 0x2014 (Unicode, AndaleMono); I can see it here. What's the 0x0097 that Dave spoke of?
     
  12. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    Em dash in Windows 1525, and a number of other Windows code pages.
     
  13. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    1525? ... 1252? ... Windows: Western?
     
  14. dcantor

    Joined:
    May 29, 2008
    Messages:
    507
    Likes Received:
    3
    1252.
     
  15. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,972
    Likes Received:
    30
    OK, it's there, 0x97 in the code page. And it's supported by my font (Andale Mono). I can see it with echo "%@char[0x2014]". But "echo %@char[0x97]" gives me the unprintable symbol. Can I use the 0x97 in any way?
     
  16. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,312
    Likes Received:
    39
    So this dyslexic man walks into a bra....
     

Share This Page