Ticket #5870 (closed defect: wontfix)

SVN Diffs for #5870

 

Opened 1 year ago

Last modified 1 year ago

ucnv_toUChars from UTF32 doesn't work with srcLength=-1

Reported by: mhaubi@... Assigned to: somebody
Priority: major Milestone: UNSCH
Component: conversion Version: 3.6
Keywords: Cc:
Load: Xref:
Java Version: Operating System:
Project (C/J): ICU4C Weeks:
Review:

Description

Problem is that in case of srcLength=-1 a normal libc's strlen() is used to determine length of source string in ucnv_toUChars().

This doesn't work with UChar32 (or UChar) based source strings.

Attachments

Change History

08/22/07 18:07:08 changed by grhoten

  • status changed from new to closed.
  • weeks changed.
  • xref changed.
  • resolution set to wontfix.
  • revw changed.

This works as designed. This isn't the only function that works like this.

If you really have data written as UChar, then you're wasting a lot of time during the conversion process.

Generally speaking, UChar32 (UTF-32) isn't used by most programs unless it's used for wchar_t. ICU has almost no APIs that use UChar32 strings. If you're interpreting wchar_t strings, then this conversion process your performing is incorrect. You should be using u_strToWCS and u_strFromWCS instead. The wchar_t type isn't always Unicode based, and these functions handle the non-Unicode whcar_t types. You can use UnicodeString::getBuffer(minCapacity) and UnicodeString::releaseBuffer with these functions to read or write to a UnicodeString.


Add/Change #5870 (ucnv_toUChars from UTF32 doesn't work with srcLength=-1)




Anti spam check: