Changeset 15007 for gsdl/trunk


Ignore:
Timestamp:
2008-02-22T11:36:08+13:00 (16 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.

File:
1 edited

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;
Note: See TracChangeset for help on using the changeset viewer.