sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/

lib/sup/util/locale_fiddler.rb (761B) - raw

      1 ## the following magic enables wide characters when used with a ruby
      2 ## ncurses.so that's been compiled against libncursesw. (note the w.) why
      3 ## this works, i have no idea. much like pretty much every aspect of
      4 ## dealing with curses.  cargo cult programming at its best.
      5 require 'fiddle'
      6 require 'fiddle/import'
      7 
      8 module LocaleFiddler
      9   extend Fiddle::Importer
     10 
     11   SETLOCALE_LIB = case RbConfig::CONFIG['arch']
     12                   when /darwin/; "libc.dylib"
     13                   when /cygwin/; "cygwin1.dll"
     14                   when /freebsd/; "libc.so.7"
     15                   else; "libc.so.6"
     16                   end
     17 
     18   dlload SETLOCALE_LIB
     19   extern "char *setlocale(int, char const *)"
     20 
     21   def setlocale(type, string)
     22     LocaleFiddler.setlocale(type, string)
     23   end
     24 end