Recent

Author Topic: How ANSI character map should behave on multibyte code pages  (Read 41489 times)

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #15 on: August 04, 2009, 09:35:23 am »
Vincent Snijders,
You know,  charactermapdlg.pas-5.zip can not work very well (see bug report note id #0029399 and screen shot charactermapdlg.pas-5.PNG).
For charactermapdlg.pas-5,
when I move my mouse on #$80..#$FE,
it shows incorrect Decimal and Hex number!
ASCII Dec Hex UTF-8 Display as (see the screen shot)
129   63  3F  C281  square
130   63  3F  C282  square
131   63  3F  C283  square
...   ... ... ...   ...
159   63  3F  C29F  quuare
160   63  3F  C2A0  space
161   63  3F  C2A1  letter i
162   51  33  C2A2  letter c with a line
163   52  34  C2A3  letter L with a line
164   161 A1  C2A4  small square
165   54  36  C2A5  letter Y with two lines
166   63  3F  C2A6  spilliter
167   161 A1  C2A7  two letter S's
168   161 A1  C2A8  two dots
169   63  3F  C2A9  letter C with circle
170   63  3F  C2AA  small number 2
171   63  3F  C2AB  two "less than" characters
...   ... ... ...   ...
Snapshot here
You said in the bug note:
Quote
I committed the last patch. Thanks.
I don't know what patch did you use,
Maybe use charactermapdlg-4.zip is better.
charactermapdlg.pas.diff.fixcrash.zip does not work, too.
Re: theo
Quote from: charactermapdlg.pas.diff.fixcrash.zip by theo
Code: Pascal  [Select][+][-]
  1. CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]);
Character #128..#255 need 2 bytes in UTF-8.
We need to convert UTF-8 to Unicode, then convert to ANSI,
or Col*16+Row-17.
Please test it by yourself, is it OK?
So, if you think, these patches are all not perfect, please tell us, let us write a new patch.
In my opinion, use Patch 4 is great.
« Last Edit: August 04, 2009, 10:53:59 am by Sam Bliss »
The stars are brilliant tonight!

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: How ANSI character map should behave on multibyte code pages
« Reply #16 on: August 04, 2009, 09:43:37 am »
charactermapdlg.pas.diff.fixcrash.zip does not work, too.

Is the IDE still crashing?

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #17 on: August 04, 2009, 10:02:24 am »
Let me think,
this patch is yours right?
I said the thing wrong here
Re: theo
Quote from: charactermapdlg.pas.diff.fixcrash.zip by theo
Code: Pascal  [Select][+][-]
  1. CharOrd := Ord(UTF8ToAnsi(StringGrid1.Cells[Col, Row])[1]);
Character #128..#255 need 2 bytes in UTF-8.
We need to convert UTF-8 to Unicode, then convert to ANSI,
or Col*16+Row-17.
Please test it by yourself, is it OK?
« Last Edit: August 04, 2009, 10:03:58 am by Sam Bliss »
The stars are brilliant tonight!

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #18 on: August 04, 2009, 10:05:56 am »
Still now,
there's only one patch works!
No.4 Patch.
The stars are brilliant tonight!

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: How ANSI character map should behave on multibyte code pages
« Reply #19 on: August 04, 2009, 10:08:10 am »
What is wrong there?

What does AnsiToUTF8(#200) return for your codepage? Doesn't it return the empty string?

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #20 on: August 04, 2009, 10:27:15 am »
Yes!
The stars are brilliant tonight!

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #21 on: August 04, 2009, 10:29:01 am »
Code: Pascal  [Select][+][-]
  1. UTF8Encode(WideChar(#200));
This works.
Look at the caption of two forms in screen shots.
« Last Edit: August 04, 2009, 10:53:32 am by Sam Bliss »
The stars are brilliant tonight!

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: How ANSI character map should behave on multibyte code pages
« Reply #22 on: August 04, 2009, 10:33:04 am »
I committed charactermapdlg.pas.diff.fixcrash.zip.

I still don't understand what causes the crash then (You say it doesn't work). The lower half of the ansi table is empty and not used anymore for your code page.


theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: How ANSI character map should behave on multibyte code pages
« Reply #23 on: August 04, 2009, 10:34:34 am »
@Sam Bliss:

Your bug report was:

Quote
When I use ANSI charactor map and put the mouse on 0000128..0000255,
the dialog shows.
                  Lazarus
============================================
Access voilation.

Press OK to ignore and risk data corruption.
Press Cancel to kill the program.
============================================

Does this still happen as of SVN version 21089    ?

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #24 on: August 04, 2009, 10:37:57 am »
Sorry, I have not downloaded SVN version 21089.
If you have, give me the oringal code of charactermapdlg.pas,
I will test it.
« Last Edit: August 04, 2009, 10:41:02 am by Sam Bliss »
The stars are brilliant tonight!


Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #26 on: August 04, 2009, 10:43:00 am »
I mean when you move you mouse on #$80..#$FE,
the label under the string grid shows incorrect ASCII code.
« Last Edit: August 04, 2009, 10:51:50 am by Sam Bliss »
The stars are brilliant tonight!

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: How ANSI character map should behave on multibyte code pages
« Reply #27 on: August 04, 2009, 10:44:03 am »
But that was not your original bug report. You said it crashes. Does it still?

Sam Bliss

  • New Member
  • *
  • Posts: 23
  • Brilliant
Re: How ANSI character map should behave on multibyte code pages
« Reply #28 on: August 04, 2009, 10:50:00 am »
I tried.
See attached files.
The stars are brilliant tonight!

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: How ANSI character map should behave on multibyte code pages
« Reply #29 on: August 04, 2009, 10:51:54 am »
What is wrong about that?

What codepage do you use?

 

TinyPortal © 2005-2018