Changeset 15007

Show
Ignore:
Timestamp:
22.02.2008 11:36:08 (11 years ago)
Author:
davidb
Message:

"debug_unicode_string" function added to help figure out uncoding problems. Prints out any character above 255 in \x{HEXCODE} form.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/gsprintf.pm

    r11632 r15007  
    3333use util; 
    3434 
    35 @gsprintf::EXPORT_OK = qw'gsprintf'; # functions we can export into namespace 
     35@gsprintf::EXPORT_OK = qw(gsprintf); # functions we can export into namespace 
    3636 
    3737 
     
    246246 
    247247 
     248sub debug_unicode_string 
     249{ 
     250    join("", 
     251     map { $_ > 255 ?                      # if wide character... 
     252           sprintf("\\x{%04X}", $_) :  # \x{...} 
     253           chr($_)           
     254           } unpack("U*", $_[0]));         # unpack Unicode characters 
     255} 
     256 
     257 
    2482581;