Making Find and Replace macro with "^c" and UTF-8 text (solved)

Making Find and Replace macro with "^c" and UTF-8 text (solved)

2

    Nov 15, 2011#1

    Hello,

    I am trying to make macro that will take a word list and a corpus that I have and search for the words in the word list in the corpus and do a replace. I am trying to select and copy each word in the list then do this in the macro:

    Code: Select all

    Find "^c"
    Replace All " "
    The text copied to the clipboard is in the Khmer language, which is UTF-8. I cannot get the macro to copy and search for and replace the text correctly. Any help? Thanks.

    Adam
    UE v15.20

    6,677581
    Grand MasterGrand Master
    6,677581

      Nov 15, 2011#2

      ^c and ^s are not working for Unicode strings in a Unicode encode file in UltraEdit for Windows < v24.00 and UEStudio < v17.00. Only ANSI strings (= strings containing only characters available in system code page) can be searched/replaced using ^c and ^s in ANSI or Unicode files. I have reported this more than one year ago to IDM support by email. ^c and ^s never supported in any version of UltraEdit up to current version v17.30.0.1002 strings with characters not available in current system code page.

      Same problem exists also in script environment. Whether UltraEdit.activeDocument.selection as replacement for ^s nor UltraEdit.clipboardContent as replacement for ^c can be used to find a Unicode string selected/copied before.

      I can only suggest as workaround to either open both files with File - Open with option Open As set to ASCII for opening the UTF-8 encoded files as ASCII/ANSI files and run the finds/replaces in ASCII mode, or do the finds/replaces in hex edit mode which can be done only with a not really easy to code script because ^c and ^s are not working at all in hex edit mode.

      Perhaps there will be another user familiar with how to work with Unicode strings in scripts who can offer a script solution working in text editing mode too.

      2

        Nov 16, 2011#3

        Thanks for the reply. I found a slight workaround. I have used one of these online tools to convert my uft-8 text and list to decimal codes. Then I can perform the S&R using those codes. Once finished I once again convert it back into utf-8. One of these tools is found here. This method is successful. The macro was searching for and replacing the codes correctly. So this is a workaround for S&R Unicode text using the "^c" variable.

        Adam

        6,677581
        Grand MasterGrand Master
        6,677581

          Nov 17, 2011#4

          Fine. I just want to add that the HTML toolbar of UltraEdit contains also the command HTML URI Encode/Decode. Selecting the contents of a UTF-8 file, using URL Encode and later after macro finished select everything again and use URL Decode may work too without any third-party tool. URL Encode and URL Decode are not available as macro commands.

            Feb 12, 2017#5

            ^c and ^s support Unicode characters not available in system code page since UltraEdit for Windows v24.00 and UEStudio v17.00 which means full Unicode support by ^c and ^s.
            Best regards from an UC/UE/UES for Windows user from Austria