Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode support needed #27

Open
KelvinShadewing opened this issue Oct 6, 2021 · 0 comments
Open

Unicode support needed #27

KelvinShadewing opened this issue Oct 6, 2021 · 0 comments

Comments

@KelvinShadewing
Copy link
Owner

As it is, the engine only seems to support ASCII characters between 0 and 127, and it's not the bitmap test fonts I'm using, as those are full CP-437 fonts. In order for games to show languages other than English, many languages require Unicode. I've tried adding Unicode myself, but to no success. I added #define SQUNICODE, which set Squirrel to Unicode mode, but that caused a ton of compile errors. After fixing all those errors, by converting normal strings to wchar_t arrays as needed, it compiled, but then started throwing segfaults as soon as it launched.

I've found conflicting information on converting char and wchar_t, and the functions I came up with to convert them are as follows:

wchar_t* towc(const char* s) {
	const size_t csize = strlen(s) + 1;
	wchar_t *wsarg;
	mbstowcs(wsarg, s, csize);
	return wsarg;
};

char* tostr(const wchar_t* s){
	char* csarg;
	wctomb(csarg, *s);
	return csarg;
};

These could be the issue.

The rest of the code is basically just adding L to the beginning of every string. I've added a folder with the Unicode edits made here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant