replace and unicode?

Klaus major-k klaus at major-k.de
Thu Sep 7 06:55:59 EDT 2017


Hi Mark,

> Am 07.09.2017 um 12:47 schrieb Mark Waddingham via use-livecode <use-livecode at lists.runrev.com>:
> 
> On 2017-09-07 12:35, Klaus major-k via use-livecode wrote:
>> Hi firends,
>> I am trying to replace "mm2" in a unicode text file with "mm(superscript2)"
>> but obviously "replace" does not do what I want or I am missing something!?
>> My effort so far:
>> ...
>> ## Read TXT file and make it LC compatible, this is doing fine:
>> put url ("binfile:" & tFile) into tData
>> put textdecode(tData,"UTF-8") into tDataComplete
>> replace CRLF with CR in tDataComplete
>> ## Superscript 2 in Unicode
>> put numToCodepoint(0x00B2) into tSup
>> ## But this line does nothing actually?
>> replace "mm2 " with ("mm" & tSup & " ") in tDataComplete
> 
> I tried:
> 
> put "mm2 foo Танюша mm2 bar" into tText
> put numToCodepoint(0x00B2) into tSup
> replace "mm2 " with ("mm" & tSup & " ") in tText
> put tText
> 
> Here in a variety of versions and it seems to work...
> 
> What is the contents of tDataComplete in the case you can't get to work?

The line in question before "replace":
40mm2 100mm2 200mm2

The line in question after "replace":
40mm2 100mm2 200mm2

???

Even this in a field with that line does not work?
...
put numToCodepoint(0x00B2) into tSup
replace "mm2 " with ("mm" & tSup & " ") in fld 1
...
? 

Tried with LC 8.16 Stable on macOS 10.12.6.

> Warmest Regards,
> 
> Mark.

Best

Klaus

--
Klaus Major
http://www.major-k.de
klaus at major-k.de





More information about the use-livecode mailing list