Search found 3805 matches

by TJF
Apr 06, 2022 15:23
Forum: Beginners
Topic: C function typedef
Replies: 5
Views: 801

Re: C function typedef

typedef int foo(int x, int y); is a function prototype and translates to TYPE foo AS FUNCTION(BYVAL AS LONG, BYVAL AS LONG)AS LONG Note: int (32 bit in C) translates to LONG in order to work on 32- and 64-bit FB code. Perhaps you want to check h_2_bi for such translations. Install it in Geany IDE a...
by TJF
Apr 06, 2022 4:33
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: [SOLVED] Pass UTF-8 strings

Imagine you have this valid source in any encoding: var s = "test 中国語" rtlib_func( s ) What kind of encoding (bytes in memory) should rtlib_func() expect to receive and why? When there is no BOM, the source reads as ASCII, one byte per character. In this case the Hànzì characters in the s...
by TJF
Apr 05, 2022 11:37
Forum: Libraries & Headers
Topic: [Windows] Small GUI Library by Henri Serindat
Replies: 2
Views: 1167

Re: Small GUI Library by Henri Serindat

From my point of view it would be helpful if you add a note in the subject that you're not talking about a cross-platform, but a platform specific library (naming that platform).
by TJF
Apr 05, 2022 11:13
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: [SOLVED] Pass UTF-8 strings

BTW you were right. Geany is the best editor for FreeBASIC. OK (for now). Let us talk again when you got familiar with the basics and you had time to evaluate the sugar features (ie custom commands). And please forgive me that I didn't check your assumption regarding the fbc bug. First I concentrat...
by TJF
Apr 04, 2022 11:02
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

If there is a BOM (including UTF-8), the string is converted to a WSTRING depending on platform and the original UTF-8 encoding is lost. Windows -> UTF16LE Linux -> UTF32LE Big Endian ->UTF32BE This is a bug in fbc! The BOM can be either two, three or four bytes. It should get (platform independant...
by TJF
Apr 03, 2022 12:58
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

uint16* C_STR$0; C_STR$0 = (uint16*)L"test \x4E2D\x56FD\x8A9E"; This confirms my asumption. In case of an UTF-8 source file you'll get C_STR$0 = (uint8*)"test \xE4\xB8\xAD\xE5\x9B\xBD\xE8\xAA\x9E"; Note: your characters are two bytes in length, the UTF-8 encoded characters are t...
by TJF
Apr 03, 2022 11:05
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

@TJF On Windows Command Prompt prints meaningless unicode character, after "chcp 65001" prints full of squares. But if redirect the output to test.txt (without changing codebase first), it output the correct string 中国語. Your reports are horror. My last code produces three outputs: The win...
by TJF
Apr 03, 2022 7:45
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

Just for curiosity, what's the output from

Code: Select all

VAR c_str = @CHR(&h74, &h65, &h73, &h74, &h20 _
               , &he4, &hb8, &had, &he5, &h9b, &hbd, &he8, &haa, &h9e)
test_C_function(c_str)
?LEFT(*c_str, 4)
?MID(*c_str, 6)
by TJF
Apr 03, 2022 5:52
Forum: Linux
Topic: GTK Prevent X close button [Solved]
Replies: 23
Views: 6805

Re: GTK Prevent X close button [Solved]

OK, you're the expert and I need advice!

I don't understand why we need those name properties for the window widgets, but not for the button. What will we miss if we erase those lines from the XML file?
by TJF
Apr 03, 2022 5:50
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

In order to test an UTF-8 application, it's clever to prepare the system for correct debug output in the console. I've developed more than 100 UTF-8 applications, from minimal examples to real projects, and never faced any issue in the compiler. I'm sure my code is working on a well configured syste...
by TJF
Apr 02, 2022 17:53
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

I never tried fbc with BOM source code. But I'm sure its working without BOM -> switch to another editor. Edit: your code doesn't work, it only prints squares. Where do you see that squares? In your terminal? Is it prepared to output in UTF-8 encoding? In a first step comment out the lines with test...
by TJF
Apr 02, 2022 17:38
Forum: Linux
Topic: GTK Prevent X close button [Solved]
Replies: 23
Views: 6805

Re: GTK Prevent X close button [Solved]

One more hint: Don't name your widget. Currently you don't need properties like ... <property name="name">Main_Window</property> ... <property name="name">Sub_Window</property> ... This attribute is mainly used when implementing the GtkBuildable interface on a type. At your level...
by TJF
Apr 02, 2022 17:18
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

My source file is already UTF-8. How do you prove that? When you save my code in UTF-8 encoding, it will work. Here's the HEX output: 0x00000000: 74 65 73 74 5f 43 5f 66 75 6e 63 74 69 6f 6e 28 40 22 74 65 73 74 20 e4 b8 ad e5 9b bd e8 aa 9e test_C_function(@"test ......... 0x00000020: 22 29 0...
by TJF
Apr 02, 2022 14:06
Forum: General
Topic: [SOLVED] Pass UTF-8 strings
Replies: 35
Views: 2814

Re: Pass UTF-8 strings

Of course it gets a bit confusing because if you make sure your source code file is stored in UTF-8 (which you can do even on Windows), then the string literals will already be UTF-8 encoded. Encoding the FB source in UTF-8 is mandatory for using that C-lib. Each serious IDE should do this by defau...
by TJF
Apr 02, 2022 14:01
Forum: Linux
Topic: GTK Prevent X close button [Solved]
Replies: 23
Views: 6805

Re: GTK Prevent X close button [Solved]

You're inert against any piece of advice! Won't you understand, or can't you understand? Try this: XML "example_glade.ui" <?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.38.2 --> <interface> <requires lib="gtk+" version="3.24"/> <o...