How to use Split function with Unicode Delimiter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NewUser13
    New Member
    • Jul 2022
    • 5

    How to use Split function with Unicode Delimiter

    Hello everyone, i am facing some issue with unique delimiter in visual basic 6. I am trying to create security application which is compatible with Chinese Windows. Although i did many tests today, its still doesn't work. It works only on English Windows.I am pasting the code, and if someone have any idea, i would be grateful for the guidance.
    P.s so far, i understood that i need to use ChrW , but as i said, it still doesn't work.
    That's not the whole code, just the part that i need to be converted to works on Chinese and other Languages.

    The problem are 2 from what i see, the first the split function, how to convert to Unicode, and second does the String must be converted fromUnicode?
    on this line - test YO, StrConv(sData(1 ), vbFromUnicode)


    Code:
    Sub Main()
    
    
    Dim YO As String, Datos As String, sData() As String
    
    YO = App.Path & "\" & App.EXEName & ".exe"
    
    Open YO For Binary As #1
    Datos = Space(LOF(1))
    Get #1, , Datos
    Close #1
    
    sData() = Split(Datos, "DELIMITER1")
    
    sData(1) = TEST2(sData(1), "TEST")
    
    test YO, StrConv(sData(1), vbFromUnicode)
    End
    Last edited by zmbd; Jul 29 '22, 04:58 AM. Reason: [z{placed [CODE/] format}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Might be helpful if you could post the UNICODE value of the delimiter that is giving you such problems.

    Comment

    • NewUser13
      New Member
      • Jul 2022
      • 5

      #3
      Code:
      sData() = Split(Datos, "ChrW(&H4E00)")

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        take the quotes out: sData() = Split(Datos, ChrW(&H4E00))

        Comment

        • NewUser13
          New Member
          • Jul 2022
          • 5

          #5
          Already tried, it does not work.. The problem is not there.

          Comment

          • zmbd
            Recognized Expert Moderator Expert
            • Mar 2012
            • 5501

            #6
            This may not be the "root" issue; however, the double-quotes were absolutely preventing Split() from functioning as expected.
            I'm suspecting that there's an incompatibility within/between the different versions of the OS in how they handle the unicode tables

            Also... would you try sData() = Split(Datos, ChrW(19968))
            I know, the HexValue should work; however, sometimes the conversion goes wonky

            Next thing - exactly
            How is this not working
            What is it returning, if anything, that doesn't match expectations
            What error messages, if any, are you getting - please give the exact error number and entire error message (error numbers are often generic with the message providing much more detail).
            Last edited by zmbd; Jul 29 '22, 05:19 PM.

            Comment

            • NewUser13
              New Member
              • Jul 2022
              • 5

              #7
              About the quotes, when I use quotes, the output file comes out damaged. And the file doesn't work even on English Windows.



              When I use quotes, the file is okay, it works on English Windows.



              When I moved the file, and try to run on Chinese Windows, I am getting "WerFault" . The file just won't run.



              The algorithm that I am trying to develop is for protection against cracking, modification etc. I am using the RC4 encryption algorithm.
              I am using builder, where I load the original file, and return it protected with that algorithm. Maybe you're right about the quotes of the second part of the code.
              But, when i am trying to remove the quotes in my builder, the file comes out damaged. So to remove quotes maybe is okay on this part of the code shared here, but when I removed it on the builder, the file comes out damaged.

              Comment

              • zmbd
                Recognized Expert Moderator Expert
                • Mar 2012
                • 5501

                #8
                WerFault.exe is a windows error trap module. If you can find the text of the error log in the Windows Event Viewer that would be helpful.

                I've a few personal matters to attend to right now; however, with your post of the actual error message we might figure something out

                Also, please provide the names of the tools that you are using for your development - might need to use a different IDE, change a setting, etc..
                Last edited by zmbd; Jul 31 '22, 12:50 AM.

                Comment

                Working...