Changeset 23365

Show
Ignore:
Timestamp:
01.12.2010 14:21:31 (8 years ago)
Author:
mdewsnip
Message:

Fixed problem in receptionist::append_logstr() where any strings containing multi-byte Unicode characters were truncated because the UTF-8 conversion was bad.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/receptionist.cpp

    r22231 r23365  
    759759                  ostream &logout) { 
    760760 
    761   utf8outconvertclass text_t2utf8; 
    762761  char *lfile = filename.getcstr(); 
    763762 
     
    774773  GSDL_LOCK_FILE (fd); 
    775774  if (lock_val == 0) { 
    776     text_t tmp_log_str(logstr); // so we don't pass a const to setinput... 
    777     text_t2utf8.setinput(&tmp_log_str); 
    778     char *buffer=new char[logstr.size()]; 
    779     size_t num_chars; 
    780     convertclass::status_t status; 
    781     text_t2utf8.convert(buffer, logstr.size(), num_chars, status); 
    782     // ignore status - assume it is "finished" as buffer is big enough 
     775    // Write the string out in UTF-8 
     776    text_t tmp_log_str_utf8 = to_utf8(logstr); 
     777    char *buffer = tmp_log_str_utf8.getcstr(); 
     778    size_t num_chars = tmp_log_str_utf8.size(); 
    783779    write(fd, buffer, num_chars); 
    784780    GSDL_UNLOCK_FILE (fd);