On Mar 28, 2012, at 3:58 PM, jonat...@mugginsoft.com wrote:

> 
> On 28 Mar 2012, at 14:35, Andreas Grosam wrote:
> 
>> What's the preferred method to append a sequence of bytes in encoding 
>> 'encoding' (a CFStringEncoding) to a CFMutableString object?
>> 
>> Well, the set of encodings which I'm interested in are the Unicode encoding 
>> schemes (UTF-8, UTF-16,  UTF-16LE, UTF-16BE, etc)
>> 
>> Unfortunately, there is no CFStringAppendBytes() function where I could 
>> specify the encoding.
>> 
>> 
> I presume that you considered CFStringAppendCString():
> 
> void CFStringAppendCString (
>   CFMutableStringRef theString,
>   const char *cStr,
>   CFStringEncoding encoding
> );
> 


Yes, but:

Can I use any code-unit, even so the function indicates that only "char" is 
allowed? What, if I have uint32_t or uint16_t code-unit types? (I guess, I can 
use them anyway after a type cast.) The description is not clear about this, 
though.

Also, consider that Unicode NULL (U+0000) is a regular character in Unicode - 
which conflicts with C strings which shall be zero terminated.

So, strictly, I do NOT have C strings.


I would rather prefer a function like:

void CFStringAppendBytes (
  CFMutableStringRef theString,
  const void* bytes,
  CFIndex numBytes,
  CFStringEncoding encoding
);


Andreas


> Regards
> 
> Jonathan Mitchell
> Mugginsoft LLP
> 
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/agrosam%40onlinehome.de
> 
> This email sent to agro...@onlinehome.de


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to