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

Multi-line edit field which contains multi-byte characters cannot handle line ending positions correctly #3918

Open
nvaccessAuto opened this issue Feb 24, 2014 · 11 comments
Labels

Comments

@nvaccessAuto
Copy link

Reported by nishimotz on 2014-02-24 12:43
Multi-line edit field which contains multi-byte characters cannot handle line ending positions correctly.

It occurs with desktop application which was made by Japanese version of Visual Basic 6, such as the attached executable.

setup:

  • Windows 8.1 64bit (Japanese version, however, tested with user interface language: English)
  • NVDA 2014.1rc1
  • Attached Project1.exe (provided by a Japanese software developer)

procedure:

  • launch Project1.exe, which contains an edit control on Form1.
  • write character U+3042 (Japanese phonetic 'a') for 10 times, then press Enter. It may not be pronounced correctly if the synthesizer does not support Japanese character.
  • put "hello world" at the second line of edit field.
  • with up/down arrow keys, content of first line and second line should be announced respectively, however, all the content ('a' for 10times, followed by 'hello worl', the last 'd' is dropped) is announced for both lines.
  • with laptop layout, pressing NVDA+left arrow does not stop at the end of first line. it stops at the 'l' and announces 'right'.

The quoted text below contains actual text contents which uses U+3042.

ああああああああああああああああああああ
hello world
@nvaccessAuto
Copy link
Author

Attachment Project1.exe added by nishimotz on 2014-02-24 12:44
Description:
Project1.exe developed with VB6

@nvaccessAuto
Copy link
Author

Comment 1 by jteh on 2014-02-24 21:26
I haven't looked into this yet, but it may be that this is a bug in the Edit API that we can't work around. We rely on the Edit API to give us correct line offsets. Calculating them ourselves isn't an option; it would be way too slow with a lot of content.

@nvaccessAuto
Copy link
Author

Comment 2 by nishimotz on 2014-02-24 22:43
It seems that source/NVDAObjects/window/edit.py uses EM_LINELENGTH for retrieving the length of line.

Microsoft document says "For ANSI text, this is the number of bytes".

http://msdn.microsoft.com/en-us/library/bb761613.aspx

Is that related to this issue?

@nvaccessAuto
Copy link
Author

Comment 3 by jteh on 2014-02-24 23:22
If it's an ANSI Edit control, yes. However, it's quite tricky to detect the encoding for an ANSI control. We'd probably have to go in-process (in-thread actually) and call GetThreadLocale.

@nvaccessAuto
Copy link
Author

Comment 4 by nishimotz on 2014-02-25 00:55
It seems that NVDAObjects/window/init.py already uses IsWindowUnicode() to setup isWindowUnicode property.

How about using this property?

@nvaccessAuto
Copy link
Author

Comment 5 by jteh on 2014-02-26 04:44
That only tells us whether the window is Unicode or ANSI. If ANSI, it doesn't tell us what encoding is being used, so we don't know anything about the characters that will occur.

@bhavyashah
Copy link

@jcsteh While I am not too sure about the accuracy of my interpretation, your comments seem to suggest that this ticket might be a cantfix. Could you please clarify/elaborate?

@jcsteh
Copy link
Contributor

jcsteh commented Aug 14, 2017

It needs investigation, but it's possibly fixable. See #3918 (comment) regarding using GetThreadLocale.

@nishimotz, is this still something that's relevant for Japanese users?

@nishimotz
Copy link
Contributor

Project1.zip

Original project1.exe file is attached as the zip file.

Tested with the following setup and confirmed that the issue is not resolved.

  • nvda_snapshot_master-14295,890528bd.exe
  • Windows 10 Version 1703 64bit Japanese

Original reporter who provided the executable file has migrated to the modern development tools.
However, some NVDA users in Japan still prefer old applications which use ANSI APIs.

@Adriani90
Copy link
Collaborator

@nishimotz testing with NVDA 2018.4 on Windows 10 1809 64bit german, I cannot reproduce this issue.
Are you able to reproduce it still?

@nishimotz
Copy link
Contributor

It still occurs with NVDA 2018.4 and Windows 10 1803 64bit Japanese.

I think it relates to CP 932 (Shift_JIS) of Windows default encoding.

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

No branches or pull requests

5 participants