Menu

#64 Log crashed when writing to a Unicode-enabled stream

1.0
closed
SGrottel
None
2013-11-22
2013-11-20
Christoph
No

Steps to reproduce:

  1. Create Unicode-enabled file (e.g. "a+, ccs=UTF-8")
  2. Create stream sink and enabled it.

Error:

Microsoft Visual C++ Runtime Library

Debug Assertion Failed!

Program: T:\Programmcode\blupan\x64\Debug\blutest.exe
File: f:\dd\vctools\crt_bld\self_64_amd64\crt\src\fprintf.c
Line: 65

Expression: ( (_Stream->_flag & _IOSTRG) || ( fn = _fileno(_Stream), ( (_textmode_safe(fn) == __IOINFO_TM_ANSI) && !_tm_unicode_safe(fn))))

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)


Abbrechen Wiederholen Ignorieren

Discussion

  • SGrottel

    SGrottel - 2013-11-21

    It seems like when a file is opened with a unicode encoding (like reported) then the ANSI versions of, e.g., printf will fail. Only the unicode versions, i.e. fwprintf, will work and will perform the required conversions.

    As the log internally already stores all text strings in UTF-8 I am not too sure how to fix it without introducing additional, unsually unneccessary conversions.

     
  • SGrottel

    SGrottel - 2013-11-21
    • status: open --> accepted
    • assigned_to: SGrottel
     
  • SGrottel

    SGrottel - 2013-11-22

    Fixed: Stream-Sinks will now use unicode implementations on windows and ansi implementations on Linux. Changed implementation using a template-utility-class, which might even be an improvement over the old implementation in terms of performance (using only one printf-type-function instead of previously three).

     
  • SGrottel

    SGrottel - 2013-11-22
    • status: accepted --> closed
     

Log in to post a comment.