0

a little out of my depth here but researching hard before asking the questions. This is a little long but I will try to give everything I have done so far.

I am trying to compile the Hunspell example projects. I am stuck with using D5ent as I am retired and cannot afford to buy later versions as I only program for myself now.

The first problem I have is PPChar but some searching suggests two options to replicate this in D5.

type
  PPChar = Array[0..0] of PChar; { with Range check off }

or

  PPChar = Array of PChar;

Both seem to compile OK. But in the final part of the project in order to display the spelling suggestions the Project has...

Memo1.Lines.Add(UTF8Decode(wrds^));

UTF8Decode does not exist in D5, so more research turned up this page here. Utf8ToString and older Delphi versions

With thanks to Arnaud, I downloaded and created two units SynCommons and SynLZ (required by SynCommons). I included the routine Arnaud described and then changed the Project

Memo1.Lines.Add(UTF8Decode(wrds^));

to

Memo1.Lines.Add(UTF8DecodeToString(@wrds,SizeOf(@wrds)));

That compiles OK but when I run the Project I get a list of graphics characters.

Finally the questions: What am I doing wrong? How do I make it work?

Thanks

Community
  • 1
  • 1
user983145
  • 219
  • 1
  • 3
  • 12
  • 2
    What is wrds? SizeOf(@something) is always going to be 4 (the size of a pointer). – 500 - Internal Server Error Mar 07 '13 at 17:55
  • 1
    @kobik: It *may* show gibberish, but it also *may not*. It depends on the actual data. Decoding UTF-8 results in a Unicode string, which is `WideString` in D5. Assigning a `WideString` to an `AnsiString` performs a data conversion that results in Ansi characters which match the original Unicode characters as closely as possible when possible. Think of the Euro symbol, for example. Many Ansi charsets support that character. However, I do agree that TNT should be used to show the original Unicode data as-is instead of converting it to Ansi at all. – Remy Lebeau Mar 07 '13 at 19:13
  • @RemyLebeau, "It may show gibberish, but it also may not.": Thanks for the clarification, but I thought that was obvious :) you are 100% right of-course. +1 – kobik Mar 07 '13 at 19:17
  • Thanks guys. I had not heard of the TNT components but DL'd from the site and ran the installer. It had D5 checked for install and it did create the folder and put stuff in it. But, the lowest Delphi is D6 and that package will not install. – user983145 Mar 07 '13 at 20:58
  • 2
    You can download TNT from [here](http://www.yunqa.de/delphi/doku.php/products/tntunicodecontrols/index) - `Last Delphi 5 version`. also look at [How does accepting an answer work?](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) – kobik Mar 07 '13 at 21:33
  • @user983145: when you post a question, you need to actually mark an answer as accepted when it answers your question to your satisfaction. That way, you and the answerer both get reputation points for it. – Remy Lebeau Mar 07 '13 at 21:44
  • Yeah, I understand how it works, but the question is HOW DO I DO IT? I don't see any buttons or links to click. I am not stupid and if there as an obvious way to acknowledge then I would have been using it for as long as I have been frequenting here. It's all well and good to have these kind of neat things, but when they are not obviously displayed, it seems dumb to castigate someone for not using them. I failed mind reading 101. – user983145 Mar 08 '13 at 21:05

0 Answers0