• Welcome to PlanetSquires Forums.
 

Update

Started by Paul Squires, March 21, 2018, 10:01:04 AM

Previous topic - Next topic

Paul Squires

So, your opinion would be to maybe remove UTF-8 altogether and just stick with ANSI and UTF-16?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#76
If in WinFBE you choose Chinese Big 5 as the code page and you use


DIM cws AS CWSTR = "毛澤東"


and you save it as ansi, it will be saved as


DIM cws AS CWSTR = "¤ò¿AªF"


Then, to display it in Windows, you need to convert it to unicode specifying the correct code page:


AfxMsg AfxUcode(cws, 950)


where 950 is the code page for Chinese Big 5.

Therefore, if you use code pages, you must save the file as ansi.


José Roca

#77
Quote from: Paul Squires on July 21, 2018, 04:49:35 PM
So, your opinion would be to maybe remove UTF-8 altogether and just stick with ANSI and UTF-16?


I think so. Think about it:

If you save the file as UTF-8, to use it with Windows it must be converted to Unicode; therefore, it is more advantageous to save it directly to utf-16.

In the FreeBasic compilers for Windows, the native functions to read a file convert utf-8 string literals to WSTRINGs (utf-16 string literals don't need to be converted), but maybe the code that they use to do the conversion does not do a good job in all cases (if it does not work well with Chinese saving the file as utf-8 and it works if it is saved as utf-16 then this may be the case). An additional problem is that these functions don't work with unicode filenames.

If you treat the file as binary or use the Windows API functions or the C functions to read a file they won't convert utf-8 to unicode, so you will have to do the conversion. If it has been saved as unicode, no conversion is needed.

The only problem is the Scintilla control, that does not work with utf-16 but with utf-8. But for FreeBasic source code files there is not any need to save it as utf-8, since the compilers can work with utf-16 encoded source files.

I implemented code pages in the CSED editor for PowerBasic because this compiler only works with ansi source files.

So, I think that the only options needed are ansi and unicode. I can't see any need/advantage to save a FreeBasic source file using utf-8.

Paul Squires

Thanks Jose, that certainly gives me reason to think and consider removing UTF-8. I can say the past couple of days spending countless hours dealing with situations in the editor where code has to loaded, saved, converted between ansi, utf8 and utf16. A huge pain in the butt. I also think that I will switch all my code to use winapi for file handling just to be safe.

The only thing that I can think of where someone might question is if they are using source code files between Windows and Linux in editors where they want to save as utf8 on both platforms.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

rainheart311

Quote from: Paul Squires on July 21, 2018, 03:44:17 PM
Quote from: rainheart311 on July 21, 2018, 12:38:23 PM
2, UTF-8 (BOM) is not friendly to Chinese support.

Did you try changing the codepage for the selected font to Chinese? See attached screenshot.

Yes, I've tried all of it. Although most of them are effective, there will be spaces in individual Chinese characters.like "复制",it will be "复  制",it is hard to change.

Johan Klassen

Hi Paul :)
if I create a new project and a designer form, place a ListBox and a Button on the form
check the Click event for the button and after compiling I delete the button from the form, the code for the button remains and if compiled and executed the button shows as it had not been deleted.

Johan Klassen

Paul
when setting a project BOM from ANSI to UTF-16 everything but the event code is in triplicate, for example

#include once "WinFormsX\WinFormsX.bi"
Declare Function Form1_Load( ByRef sender As wfxForm, ByRef e As EventArgs) As LRESULT
Declare Function Form1_Load( ByRef sender As wfxForm, ByRef e As EventArgs) As LRESULT
Declare Function Form1_Load( ByRef sender As wfxForm, ByRef e As EventArgs) As LRESULT

Johan Klassen

if you save a project and exit WinFBE and relaunch WinFBE and reload the project it will duplicate event code

Paul Squires

Quote from: Johan Klassen on July 22, 2018, 01:10:25 AM
Hi Paul :)
if I create a new project and a designer form, place a ListBox and a Button on the form
check the Click event for the button and after compiling I delete the button from the form, the code for the button remains and if compiled and executed the button shows as it had not been deleted.
Thanks Johan - all fixed now. I set the file to dirty but omitted to set the code regeneration flag to true.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Quote from: Johan Klassen on July 22, 2018, 02:55:50 AM
if you save a project and exit WinFBE and relaunch WinFBE and reload the project it will duplicate event code
This one is now fixed also. Had to reparse the document code prior to checking for non-existent event handlers.

I am preparing a full package to upload to GitHub.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Hi Paul,
On my Windows 10 machine the following click sequence will crash WinFBE64.exe:
-Start program WinFBE
-Select sample project VisualDesigner
-Select tab frmLogin.inc
-Select tab Design
-Select Tools/Properties
-Select any control on the form.

Also crashes if the control is selected first and then the Properties tab is clicked.
Clive Richey

Paul Squires

Quote from: SeaVipe on July 22, 2018, 05:08:02 PM
Hi Paul,
On my Windows 10 machine the following click sequence will crash WinFBE64.exe:
-Start program WinFBE
-Select sample project VisualDesigner
-Select tab frmLogin.inc
-Select tab Design
-Select Tools/Properties
-Select any control on the form.

Also crashes if the control is selected first and then the Properties tab is clicked.

Thanks! Yes, that bug was reported over in the FreeBasic forum a couple of days ago. I fixed it for the 64 bit version (it did not show in the 32 bit version). I'm uploading a new package now.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

Same for me, just the 64 bit.Thanks.
Clive Richey

Johan Klassen

#88
Thank you Paul :)