471,049 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

How to use Split function with Unicode Delimiter

5 Nibble
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)

Expand|Select|Wrap|Line Numbers
  1. Sub Main()
  4. Dim YO As String, Datos As String, sData() As String
  6. YO = App.Path & "\" & App.EXEName & ".exe"
  8. Open YO For Binary As #1
  9. Datos = Space(LOF(1))
  10. Get #1, , Datos
  11. Close #1
  13. sData() = Split(Datos, "DELIMITER1")
  15. sData(1) = TEST2(sData(1), "TEST")
  17. test YO, StrConv(sData(1), vbFromUnicode)
  18. End
2 Weeks Ago #1
7 7269
5,486 Expert Mod 4TB
Might be helpful if you could post the UNICODE value of the delimiter that is giving you such problems.
1 Week Ago #2
5 Nibble
Expand|Select|Wrap|Line Numbers
  1. sData() = Split(Datos, "ChrW(&H4E00)") 
1 Week Ago #3
5,486 Expert Mod 4TB
take the quotes out: sData() = Split(Datos, ChrW(&H4E00))
1 Week Ago #4
5 Nibble
Already tried, it does not work.. The problem is not there.
1 Week Ago #5
5,486 Expert Mod 4TB
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).
1 Week Ago #6
5 Nibble
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.

1 Week Ago #7
5,486 Expert Mod 4TB
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..
1 Week Ago #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by NewToThis | last post: by
3 posts views Thread by Reb | last post: by
6 posts views Thread by andrewcw | last post: by
9 posts views Thread by martinskou | last post: by
4 posts views Thread by grey15 | last post: by
1 post views Thread by John | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.