...your non-English Max WinAPI 2 interfaces display a bunch of random symbols instead of proper strings?
...39DLL or other networking libs send non-English strings in sizes which are at least twice as big as those strings' lenghts?
in Game Maker 8.1?
Or do you have a similar problem and don't know what to do?
Yes, these are common problems when using Game Maker 8.1 and old extensions created for earlier versions of GM.
It's known that GM 8.1 began to use two-bytes Unicode (UTF-8) instead of the default one-byte codepages.
But now it's not a problem!
That's where the
-= CODEPAGE CONVERTER =-
What does this thing actually do?
Codepage Converter is an extension for Game Maker to provide string conversion between different codepages.
It's recommended to use when you send strings to the extension which expects ANSI or when you get ANSI string results from the extension which GM 8.1 doesn't understand.
This ensures compatibility between GM 8.1 and old extensions.
How do I use this extension?
Codepage Converter is simple as an orange. There are two ways how to use it:
//ext_get_string() and ext_give_string() are imagined functions to show the principle of work //first returns one-byted string, second waits for one-byted string var result_str; //variable to get one-byted string result from the imagined extension ;) //FIRST WAY set_cpconv(1251); //sets ANSI-1251 codepage for all standard converting processes result_str = to_utf8(ext_get_string()); //getting one-byted string result and converting it from ANSI-1251 to the UTF-8 codepage ext_give_string(from_utf8(result_str)); //converting UTF-8 string to the ANSI-1251 codepage and sending it to the function //SECOND WAY result_str = to_utf8_alt(ext_get_string(), 1251); //getting one-byted string result and converting it from ANSI-1251 to the UTF-8 codepage ext_give_string(from_utf8_alt(result_str, 1251)); //converting UTF-8 string to the ANSI-1251 codepage and sending it to the function
Full descriptions of all functions and predefined constants you can read in the ReadMe.txt which is in the archive with the extension.
How does this extension work?
Codepage Converter uses WinAPI functions WideCharToMultiByte() and MultiByteToWideChar() to perform the string conversion. That is, this extension will only work on the Windows version of Game Maker 8.1. If someone wants to rewrite this extension to increase the perfomance, reduce extension file size, create a cross-platform version or for something like that, I'll be all for it.
Stanislav Budinov aka trew for the help with understanding working principles of WinAPI functions.
PrimuS for the help with writing this post on English. :D
http://www.mediafire...1dcg7l10iwk6lq6 (~5 Kb; .7z)
Previous version was downloaded... 24 times.)
If you have any questions about the library, any requests or any bug reports, do post them here. I'll be glad to answer you.
I hope you will find this stuff useful.
Edited by Black Doomer, 11 May 2013 - 03:51 AM.