replace and unicode?

Mark Waddingham mark at livecode.com
Thu Sep 7 06:47:55 EDT 2017


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?

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list