Hello Guest it is March 29, 2024, 04:34:12 AM

Author Topic: Mach4 does not support Unicode?  (Read 2319 times)

0 Members and 1 Guest are viewing this topic.

Mach4 does not support Unicode?
« on: February 12, 2018, 12:01:46 PM »
Hi,

I really appreciate all the help you members given to me.
I'm growing little by little. ;)

I had used DeskCNC for a while...
As you might know, it was discontinued a few years ago... very old fashioned software....
But it supported unicode and I didn't have to change folder names and .nc file names into pure English alphabet.
I just manage the file names in Korean language.

But Most recent Mach4 doesn't seem to support unicode.
If any Korean alphabet is included in the path to .nc file(no matter it is folder name or nc file name...), Mach4 cannot load it.

Mach4 doesn't support it? or I should change any configuration in Mach4?
Re: Mach4 does not support Unicode?
« Reply #1 on: February 13, 2018, 12:59:34 AM »
Mach4 doesn't support it? or I should change any configuration in Mach4?

I send this issue.

But found more: lua script load/save on UTF8, but runs on 8bit coding.
Don’t do good – won’t endure the evil
Re: Mach4 does not support Unicode?
« Reply #2 on: March 08, 2018, 02:42:20 PM »
Mach4 doesn't support it? or I should change any configuration in Mach4?

I send this issue.

But found more: lua script load/save on UTF8, but runs on 8bit coding.



Is this a bug to be fixed? or They will keep this maintained?
I don't understand why Mach4 does not support correct unicode...
Mach3 does not have this problem, doesn't it? ;(
Re: Mach4 does not support Unicode?
« Reply #3 on: March 08, 2018, 02:43:01 PM »
Would anyone let me know whether Mach4 team has will to fix this?

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Mach4 does not support Unicode?
« Reply #4 on: March 08, 2018, 06:18:29 PM »
The RS274NGC spec is ASCII.  So nothing in a G code file can be other than that.  The parser parses 8 bits (one byte) at a time and has no support for two byte wide characters.  This limitation was also in Mach 3 and will most likely will never change.  

However, the GUI elements can contain UNICODE.  So users can see the text on buttons and other controls in their native character encoding.  But the core (where the interpreter resides) is all ASCII.  This includes the API to the core as well.  Strings passed to the API functions are char * (single byte NULL terminated strings).  This is why filenames must be ASCII.  The reason for this is cross platform capability (Linux and Mac) because only "char *" is standard between them.  I'm investigating ways around that but I have not found a solution yet.  I KNOW that wide character strings (where each character is always two bytes or more) can never work with "char *", but multi-byte encodings such as UTF-8 may.  It is a complex problem.  I certainly don't know much about mult-ibyte characters, as I grew up in a world of single byte characters. And I am hampered by the fact that my native language is English.

Mach 3 was Windows only and used ONE compiler.  Therefore, it used the Windows wide character format and MFC wide character strings.  This removed the constraints of the string format but forced the constraint using just one compiler without the hope of Mach 3 EVER running on another OS other than Windows.  I suspect that this is the reason that DeskCNC worked as well.  But as I said, even Mach 3 could only use ASCII characters in the G code.  

So this will remain a work in progress.  

Steve

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Mach4 does not support Unicode?
« Reply #5 on: March 09, 2018, 04:01:01 AM »
There is a new build, 3713, that may help you and those looking for multi-byte character support.  ftp://machsupport.com/Mach4/DevlopmentVersions/Mach4Hobby_Installer-4.2.0.3713.exe

Be aware the LUA strings can contain multi-byte characters, but it cannot properly count the length of such strings.  So be careful if you are using multi-byte characters with LUA.  Things will display correctly, but any string manipulation functions might not work are expected.

Also, the machine.ini in the profile's directory can't be edited and multi-byte characters inserted into it.  It will store them, but they are stored as UTF-8 encoded ASCII.  Once mach reads these, they are then converted to UNICODE.  But if you put a multi-byte character in that file manually with a text editor, it will not be read by Mach properly. 

Also, the G code file still need to be ASCII, so no multi-byte characters can exist in them.  But filename and paths should work now.  However, do not install Mach in a path that contains multi-byte characters.  That may not work.

Notice the filename in the screen shot below.  My wife is Korean and she taught me that.  :)

Steve
« Last Edit: March 09, 2018, 04:05:48 AM by smurph »
Re: Mach4 does not support Unicode?
« Reply #6 on: March 09, 2018, 04:08:52 AM »
There is a new build, 3713, that may help you and those looking for multi-byte character support.  ftp://machsupport.com/Mach4/DevlopmentVersions/Mach4Hobby_Installer-4.2.0.3713.exe

Be aware the LUA strings can contain multi-byte characters, but it cannot properly count the length of such strings.  So be careful if you are using multi-byte characters with LUA.  Things will display correctly, but any string manipulation functions might not work are expected.

Also, the machine.ini in the profile's directory can't be edited and multi-byte characters inserted into it.  It will store them, but they are stored as UTF-8 encoded ASCII.  Once mach reads these, they are then converted to UNICODE.  But if you put a multi-byte character in that file manually with a text editor, it will not be read by Mach properly. 

Also, the G code file still need to be ASCII, so no multi-byte characters can exist in them.  But filename and paths should work now.  However, do not install Mach in a path that contains multi-byte characters.  That may not work.

Notice the filename in the screen shot below.  My wife is Korean and she taught me that.  :)

Steve


Thanks for your kind explanation. ;)

In fact, what I want is I can use multi-byte characters in "Folder name" and "File name".

Does the build 3713 allow me to use multi-byte file and folder names? ;)

Re: Mach4 does not support Unicode?
« Reply #7 on: March 09, 2018, 07:06:10 AM »
Oh.. my bad...

Steve, you've already shown me what I exactly want. ;)

Oh, I never expected you have a Korean wife. lol~

You made a good example for the file name haha~
« Last Edit: March 09, 2018, 07:09:24 AM by ysymidi »