[futurebasic] Re: [FB] Save unicode text

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 2009 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Thu, 10 Dec 2009 08:59:51 -0700
As Michele's mentions, using a MacRoman creation is the problem.
Currently fn ContainerFindAndReplace ( in Util_Containers.incl ) calls  
the Mac Roman version ( i.e. fn ContainerCreateWithCFString ) to  
create the container from the CFString. Does your new code call the  
new version posted by Michele ( btw: the "new" version is simply a  
copy of fn ContainerCreateWithCFString with the encoding constant  
changed from _kCFStringEncodingMacRoman to _kCFStringEncodingUnicode )?

Please post a working demo showing the code that doesn't work. Seeing  
your code will answer the questions about what is going on here.  
Michele's observation about Mac roman usage being the problem is  
correct, so the code needs to be adjusted accordingly.

Brian S



On Dec 10, 2009, at 7:58 AM, Eugen Rosu wrote:

> Unfortunately, it doesn't wark.
> The Latin Exteneded-B (184) fonts as Ș, ș, Ț, ț     don't appear  
> at all.
> Eugen R.
>
> On 10.12.2009, at 16:36, Michele Neri wrote:
>
>> I'm outside of my field but looking at the implementation of  
>> ContainerCreateWithCFString it seems that it expects MacRoman  
>> encoding.
>> You could try to use a custom function that expect Unicode stream.
>>
>> Michele.
>>
>> local fn ContainerCreateWithCFStringUnicode( string as  
>> CFMutableStringRef, p as pointer )
>> '~'1
>> dim as CFIndex   length
>> dim as Handle    h
>>
>> length = fn CFStringGetLength( string )
>> h = [p]
>> long if ( h )
>> fn SetHandleSize( h, length )
>> xelse
>> h = fn NewHandle( length )
>> p.0& = h
>> end if
>> fn CFStringGetBytes( string, fn CFRangeMake( 0, length ),  
>> _kCFStringEncodingUnicode, 0, _false, #[h], length, #0 )
>> end fn
>>
>>
>> 2009/12/10 Eugen Rosu <eugen.rosu@...>
>> Hi,
>> Submittaling to Ken's example at my email "Change characters in  
>> unicode",
>> I have completed my programme with the following sequnece :
>>
>> 1. I open the text file and read the text as a container.
>> 2. Change the container into a mutable string
>> mutStrTemp = fn ContainerCreateCFString( containerText )
>> ( ex.: containerText = Bucure∫ti    -->   mutStrTem = București )
>>
>> 3. Change the unicode characters
>> 4. ........ there's the rub
>> Unfortunately, when I try change back the mutable text to a  
>> container,
>> the unicode characters are damaged. I use:
>> fn ContainerCreateWithCFString( mutStrTemp, containerText2 )
>> ( ex.:  mutStrTem = București  -->  containerText2 = Bucure A  
>> ApC√ApC√CHA Apa..... )
>>
>> So, how can I save the (mutable) text in a text file (plain text  
>> format or RTF, whatever)
>>
>> Thank you,
>> Eugen R.
>>
>> --
>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>
>>
>>
>> --
>> To unsubscribe, send ANY message to: futurebasic-unsubscribe@...
>>
>
>
> =
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@associate=
> .com
>
> =

Brian S