Weird R41-4 Charset Issue
#1

Hi.

I'm experiencing some really weird R41-4 SQL Revision charset issue.
So years ago, when I used to use R39, everything was fine, but since the update (Honestly I'm writing a new gamemode from stratch) I wasn't able to fix it. I checked every single thread, but none of them solved my issue so far.

Here are couple of pictures in regard of the issue.

Keep that in mind, that these are Hungarian characters (цьуőъ. ЦЬУŐЪ, бй, БЙ, etc)

When I execute a specific function, which loads all the rows from a table, printing their received values, this is what I receive:
Link: https://prnt.sc/mskbkj

As you can see, instead of printing the őъъ characters, it's printing a questionmark instead of them.

PHP код:
function LoadItems() {
    new 
i=-1;
    for(;++
i<MAX_ITEMS;) {
        for(new 
ItemEnum:eItemEnum; ++eItemInfo[i][e] = 0;
        
ItemInfo[i][ItemType] = ItemTypes:0;
    }
    
mysql_format(g_SQLsqlsizeof sql"SELECT * FROM `item-list`");
    
inline LoadItemsInline() {
        if(!
cache_num_rows()) return printf("No rows!");
        
i=-1;
        new 
idx;
        
printf("Printing these characters from PAWN: цьуőъű ЦЬУŐЪŰ");
        for(;++
i<cache_num_rows();) {
            
cache_get_value_int(i"id"ItemInfo[idx][ItemID]);
            
cache_get_value_int(i"ItemType"_:ItemInfo[idx][ItemType]);
            
cache_get_value_int(i"weaponId"ItemInfo[idx][ItemWeaponId]);
            
cache_get_value_int(i"ItemProtected"ItemInfo[idx][ItemProtected]);
            
cache_get_value_int(i"ItemObjectID"ItemInfo[idx][ItemObjectID]);
            
cache_get_value(i"ItemName"ItemInfo[idx][ItemName], 32);
            
printf("String Charset Check: %s"ItemInfo[idx][ItemName]);
            
Iter_Add(Itemidx);
            ++
idx;
        }
    }
    
mysql_pquery_inline(g_SQLsqlusing inline LoadItemsInline"");
    return 
1;

Table structure: https://prnt.sc/mskcq6
utf8_hungarian_ci charset (for the hungarian ЦЬУŐЪ, etc chars)

Actual database charset: https://prnt.sc/mskd14

Everything works all fine on the UCP, but not on PAWN side ...

Things I have already tried:
1.) Setting up mysql_charset("UTF-8"); during the SQL connection establishing process.
2.) Changing back the SQL column charset back to the normal one (latin1_swe)

If anybody could help me figure out this issue, I'd be more than grateful ...
Cheers.
Reply
#2

Why are u using hungarian charset? well, anyway.
Are u sure you're saving your .pwn files hungarian/utf8 charset?
Reply
#3

As you can see on the pictures, if I just simply print the special characters in PAWN it all works just fine, and shows the characters properly, as it should.

But if I fetch a varchar value from SQL, which has one of these special characters in it, PAWN just replaces them with ?. Honestly I think it has something to do with the SQL plugin itself, because it worked on R39 perfectly.
Reply
#4

Bump, any ideas?
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
The problem will be different character sets. You should just stick to utf8mb4 for MySQL, and don't worry about what pawn does.
The column type is set at utf8mb4_hungarian currently, since the only " normal one " I could choose (I'm assuming) could be utf8mb4_bin, but the issue still persist on both charsets.

If you have the time, could you please provide me with some example code?
I'm kinda out of ideas unfortunately, dont want to get back to R39.

I created a dialog which shows all the records in the table, but since it's replacing my special characters with questionmarks, it's just not looking good. I thought of replacing these characters with some self-made ASCII ones, and str_replace them after the load, but that'd be hecky.
Reply
#6

Bump.
Reply
#7

MYSQL Log:
[17:52:10] [DEBUG] cache_get_value_name(5, "ItemName", 0x04C61030, 32)
[17:52:10] [DEBUG] cache_get_value_name: assigned value: 'Baseball ьt?'
[17:52:10] [DEBUG] cache_get_value_name: return value: '1'

Bump.
Reply
#8

Update:

If I execute the following command after establishing the connection ( mysql_set_charset("utf8"); ), I get the values normally, it's PAWN issue at this point.

I'm using Notepad++
Windows 1250 Encoding (Sucks with ANSI & UTF-8 w/o BOM aswell).
Any ideas?

String prints like this now:
String Charset Check: Baseball ĂĽtĹ'

[15:16:56] [DEBUG] cache_get_value_name(5, "ItemName", 0x037B56AC, 32)
[15:16:56] [DEBUG] cache_get_value_name: assigned value: 'Baseball ьtő'
[15:16:56] [DEBUG] cache_get_value_name: return value: '1'
Reply
#9

Bump.
Reply
#10

I can confirm this issue, it doesn't matter what charset I set, some characters do not display correctly.
At this point maybe you should create an issue here: https://github.com/pBlueG/SA-MP-MySQL/issues
Reply
#11

Quote:
Originally Posted by RIDE2DAY
View Post
I can confirm this issue, it doesn't matter what charset I set, some characters do not display correctly.
At this point maybe you should create an issue here: https://github.com/pBlueG/SA-MP-MySQL/issues
Thanks, just opened an issue ticket.
https://github.com/pBlueG/SA-MP-MySQL/issues/207
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)