Thursday, January 18, 2024

Removing ZWSP 'Zero Width Space' using VB.Net

 Sometimes user will copy in a string from a web sites.

It can contain a Zero Width Space character that will not be seen and will make your life a mess.

Pasting the string into Notepad++ 

<PLCsymbol SignalName="​.bNewAMTG_Clutch_Cal" Value="true" />

and enable show all characters you will see

<PLCsymbol SignalName="​ZWSP.bNewAMTG_Clutch_Cal" Value="true" />

The ZWSP character is UniCode Char &H200B

so

Dim CleanStr as string

CleanStr=messyStr.Replace(ChrW(&H200B), "")

This will remove any ZWSP's

MySQL DateTime from .Net

 I learn the hard way that different Windows Region settings will screw up your life.

If user has a DateTime region setting not what you have as a devoloper you have to convert DateTime in your .Net program to send DateTime in MySQL format while doing UPDATE or INSERT INTO.

dim myDate as Date

myDate=now

Sending this to MySQL use following format string

INSERT INTO myTable bla bla 

Values ( myDate.ToString("yyyy-MM-dd HH:mm:ss")










MySQL to MariaDB

 Here is a good description how to migrate to MariaDb MySQL to MariaDb Example of how to dump data from MySQL port=3307: mysqldump --user=ro...