[Ace-users] ACE_Encoding_Converter question

Yongming Wang wangym at gmail.com
Wed Dec 19 08:00:04 CST 2007


Hi, this is a question about ACE_Encoding_Converter in every platform
and every version.
My question is why to_utf8 and from_utf8 didn't return the target size
finnaly written?
We didn't know how many bytes written to the target after called the
to_utf8 and from_utf8.
We have to use strlen to calculate the length again.
Is there any consideration behind this?

  /// Convert the source from UTF-16 to UTF-8 and store it in the
  /// provided target buffer.
  virtual Result to_utf8 (const void* source,
                          size_t source_size,
                          ACE_Byte* target,
                          size_t target_size,
                          bool strict = true);

  /// Convert the UTF-8 source into a UTF-16 encoding and store it
  /// in the provided target buffer.
  virtual Result from_utf8 (const ACE_Byte* source,
                            size_t source_size,
                            void* target,
                            size_t target_size,
                            bool strict = true);

Thanks,
Yongming


More information about the Ace-users mailing list