The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Manche on October 28, 2014, 02:43:12 PM

Title: [r7355]Can not input text in Japanese
Post by: Manche on October 28, 2014, 02:43:12 PM
I can not input text in Japanese when rename station, route, vehicle.

I tried input Japanese in pak48,64,96,128 and so on, but will not displayed word as I entered.

ex.) I Inputted 'てすと', when displayed 'fyh' in game.

I was confirmed with before r7100 binary is not occur this bug.

If you want to see this bug, please preparation IME(can input in Japanese).
Title: Re: [r7355]Can not input text in Japanese
Post by: Ters on October 28, 2014, 04:58:28 PM
Windows, Linux, Mac or something else? If Windows, SDL or GDI?
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on October 29, 2014, 01:06:17 PM
Quote from: Ters on October 28, 2014, 04:58:28 PM
Windows, Linux, Mac or something else? If Windows, SDL or GDI?
Windows 8, GDI.
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on October 30, 2014, 10:19:38 AM
After previous post, I tried copy and paste words into text box(station name, route name), I could do that.

But I used GDI version, why I can not input Japanese in direct ?
Title: Re: [r7355]Can not input text in Japanese
Post by: Ters on October 30, 2014, 04:21:19 PM
I think prissi is the only one who can look into this problem.
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on October 31, 2014, 12:52:21 PM
in order to check whether the problem occurs only my environment,rather than others.
Therefore I asked to other Japanese player, they replied 'I know that problem,too.'.

Moreover, I asked them what uses version, the answer was 'Ver120 or higher'.

I know the problem not occurs in Ver112.4 or lower.

Summary until now posts(w/ contains that I picked up some informations),


Title: Re: [r7355]Can not input text in Japanese
Post by: yoshi on November 01, 2014, 02:35:00 AM
I haven't checked with the latest nightly, but don't have any problem with 120.0 at least
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on November 01, 2014, 02:51:30 AM
Quote from: yoshi on November 01, 2014, 02:35:00 AM
I haven't checked with the latest nightly, but don't have any problem with 120.0 at least
I tried to be confirmed also on the r7356, But I couldn't input.
Please show how environment do you have(like my previous post)?
Title: Re: [r7355]Can not input text in Japanese
Post by: yoshi on November 02, 2014, 02:54:19 AM
I have tried with r7348 and confirmed that Japanese characters are garbled, when I tried to change a station name.
Title: Re: [r7355]Can not input text in Japanese
Post by: prissi on November 07, 2014, 10:56:28 PM
Some user seem to have troubles with WIndow8 64 bit. I had only Windows 8.1 professional english with Japanese IME for testing and there is works fine.

I may be a very windows version specific problem, since deep down Simutrans calls windows functions which exist since the dawn of windows. Even google crome has this problem when started in App mode. So maybe Simutrans must not started as App (but I have no idea how to signal this to windows). Maybe when switching to full screen mode windows make SImutrans an App. Does the input work in windowed mode?

It seems MS has introduced something called TSF (text service foundation), which would force a program to be compiled for Windows8 only to use it. Destop applications should however still get IME messages (and hence Unicode letters).

Maybe try to set the compatibility settings to Windows7?
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on November 08, 2014, 01:20:14 AM
I tried to set compatibility setting to Windows 7 in addition to windows vista and windows xp.
Windows 7:Failure
Windows Vista SP2:Failure
Windows XP SP2:Failure

may be, some hardware or system affect to simutrans.
I tried in my other sub environment.
sub environment has:
windows 7 32bit home edition
Has google IME

Result: Failure

Title: Re: [r7355]Can not input text in Japanese
Post by: prissi on November 09, 2014, 10:13:25 PM
OK, I made the main window now using a wide character function in r7360.
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on November 10, 2014, 02:22:52 AM
Quote from: prissi on November 09, 2014, 10:13:25 PM
OK, I made the main window now using a wide character function in r7360.
I couldn't download r7360 (with compile error).

I was append log file to this post.
Title: Re: [r7355]Can not input text in Japanese
Post by: Ters on November 10, 2014, 06:45:16 AM
mingw runs on an ancient C runtime that predates Microsoft's so called secure versions of string processing functions. I've tried emulating what mbstowcs_s does beyond regular mbstowcs, but the result crashes when not run in a debugger. Now I have to run off to work, so I can't offer any tried and tested solution. In this case, just using mbstowcs might be safe, though.

Update
My trouble with crashing was probably because my personal workaround for version 4 of the mingw runtime/w32api had been reverted. Since the mingw team has withdrawn that version, I have also kicked it out of my system.

That left me with a window that only said S. This seems to be something else that is strange, since even a string literal comes out that way. As for string litterals, SIM_TITLE is made up of string litterals, so I think it is actually possible to skip alle the mbstowcs nonesense and simple put L""SIM_TITLE directly into the parameters for CreateWindowExW. It works for me (except for my trouble with only the first letter showing, but when using the debugger, the actual data passed into CreateWindowExW looks correct).

Update 2
Thanks to Google and stackoverflow for pointing out that DefWindowProcW goes with RegisterClassW and/or CreateWindowExW. This might even be what causes IME to fail. It seem to recall something being done with regards to ...W or not relatively recently.
Title: Re: [r7355]Can not input text in Japanese
Post by: prissi on November 10, 2014, 10:02:55 PM
Well, using L""SIM_TITLE does not work under windows:
1>simsys_w.cc(104): error C2308: Nicht übereinstimmende Zeichenfolgen werden verkettet.
1>          wide "" wird mit narrow "Simutrans " verkettet.
Meaning "non mathching strings wide with narrow are being concentated"

EDIT: after compiling 7360 under mingw I cannot input japanese under windows7 any more ...

I think it would be helpful if we can get a little closer to the faulty revision. Some versions of SImutrans are release without COnsole opening. This may also have an impact.

EDIT2: Calling the wide windows defaulot function seems to work better on WIndows7 at least.
Title: Re: [r7355]Can not input text in Japanese
Post by: Ters on November 11, 2014, 05:51:32 AM
Quote from: prissi on November 10, 2014, 10:02:55 PM
Well, using L""SIM_TITLE does not work under windows:
1>simsys_w.cc(104): error C2308: Nicht übereinstimmende Zeichenfolgen werden verkettet.
1>          wide "" wird mit narrow "Simutrans " verkettet.
Meaning "non mathching strings wide with narrow are being concentated"

Does not work with Microsoft's C++ compiler most likely. It was a long shot.

Quote from: prissi on November 10, 2014, 10:02:55 PM
EDIT: after compiling 7360 under mingw I cannot input japanese under windows7 any more ...

Since simsys_w.cc uses DefWindowProc, and not explicitly DefWindowProcA or DefWindowProcW, could it be that MSVC now defines UNICODE by default? That would cause DefWindowProc to resolve to DefWindowProcW with MSVC, which works together with the explicit RegisterClassW, while Mingw resolves to DefWindowProcA, which messes things up.

Quote from: prissi on November 10, 2014, 10:02:55 PM
I think it would be helpful if we can get a little closer to the faulty revision.

My guess is 7206.
Title: Re: [r7355]Can not input text in Japanese
Post by: Manche on November 11, 2014, 08:14:45 AM
Earlier, I checked nightly web site, then r7363 was released.
I could input Japanese text into station name, route name.
thanks to your support.