Hi Norio,
If you check the archives, you should see a message about how I tried
using the TEC and other methods to find the appropriate encoding
parameters without success.
See <http://lists.apple.com/archives/macapp-dev/2006/Apr/msg00006.html>
for details.
Can you give me more details about the string encoding you are passing
to the CUniString_AC constructor?
Does the conversion work if you add the kUnicodeUseFallbacksBit to the
call to the OpaqueTextToUnicodeInfo::Convert method?
How does adding the kUnicodeUseFallbacksBit to the call to the
OpaqueTextToUnicodeInfo::Convert method change the way the
ConvertFromTextToUnicode function converts text?
Steve
On Fri, Jul 7, 2006, Norio Ota wrote
>Steve,
>
>Did you got the answer?
>I have a similar problem which comes CUniString_AC::Convert.
>The error code is -8754. kTECUnmappableElementErr.
>Text Encoding Conversion Manager reference says that
>the error can occur only if kUnicodeUseFallbacksBit control flag is not
>set.
>
>So I was wondering if the Convert function doesn't need to be added
>kUnicodeUseFallbacksMask in CUniString_AC::append, not only
>kUnicodeLooseMappingsMask?
>
>Thanks,
>norio
>
>
>On 2006$)ADj 4$)ATB 4$)AHU , at 07:04 AM, Steve Graesser wrote:
>
>> Hi All,
>>
>> I ran into some problems creating a CUniString_AC object with different
>> Unicode string types. I am writing code to read and write text files
>> which can be in the following encodings:
>>
>> 1. ASCII
>> 2. UTF-8
>> 3. UTF-16, Big Endian
>> 4. UTF-16, Little Endian
>>
>> The UTF files all have Byte Order Marks (BOM) which are used to
>> determine the Unicode encoding for the file.
>>
>> After reading the text in from the file, I look at the BOM and create a
>> TextEncoding for the file. For example, for the ASCII file I call the
>> following code to create a text encoding
>>
>> fEncoding = CreateTextEncoding(kTextEncodingUS_ASCII,
>> kTextEncodingDefaultVariant, kTextEncodingDefaultFormat);
>>
>> For UTF-8 file, I use
>>
>> fEncoding = ::CreateTextEncoding(kTextEncodingUnicodeDefault,
>> kTextEncodingDefaultVariant, kUnicodeUTF8Format);
>>
>> For UTF-16, Big Endian files I change the kUnicodeUTF8Format constant
>> to
>> kUnicodeUTF16BEFormat. For UTF-16, Little Endian files I change the
>> kUnicodeUTF8Format constant to kUnicodeUTF16LEFormat.
>>
>> Next, I try to construct a Unicode string with a pointer to a character
>> buffer (theChars), the number of bytes in the buffer (count) and the
>> encoding of the bytes in the buffer (fEncoding).
>>
>> aString = CUniString_AC(theChars, count, CEncoding_AC(fEncoding));
>>
>> However, the Unicode string fails to be created because the
>>
>> CUniString_AC& CUniString_AC::append(const char* s, size_type n,
>> CEncoding_AC encoding)
>>
>> method fails in the call to convert the string.
>>
>> Is it incorrect to assume that a character buffer can be converted into
>> a Unicode string with the CUniString_AC constructor?
>>
>> Isn't the proper use of the encoding parameter to specify the encoding
>> of the character buffer?
>>
>> I also noticed the CUniString_AC::Test method does not include test
>> cases for calling the append method with an encoding parameter.
>>
>> Steve Graesser White Lab Consulting LLC
>> PGP Fingerprint: 8AA4 6514 A87C FD26 A135 DBA0 F8AF 3E1B 41C5 4B5C
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Macapp-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> heart.co.jp
>>
>> This email sent to email@hidden
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macapp-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden