home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 241,988 of 243,242   
   Michael Sanders to Michael Sanders   
   Re: Unicode...   
   17 Nov 25 23:49:04   
   
   From: porkchop@invalid.foo   
      
   On Fri, 14 Nov 2025 21:03:38 -0000 (UTC), Michael Sanders wrote:   
      
   > Well, I finally got bitten by Unicode.   
   >   
   > [...]   
      
   Smallest Unicode test I can manage. Might prove handy in some contexts:   
      
   #include    
   #include    
   #include    
      
   int got_unicode(void){   
       char *l = setlocale(LC_CTYPE,"");   
       return (l && strstr(l,"UTF-8"));   
   }   
      
   #define U(uni, asc) (got_unicode() ? (uni) : (asc))   
      
   int main(void){   
       printf("%s\n", U("Unicode OK: ✓", "No Unicode."));   
       return 0;   
   }   
      
   --   
   :wq   
   Mike Sanders   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca