Saturday, November 15, 2025

When is AnsiString(String(ansstr)) <> ansstr?


Remember the good old times when strings were composed of 8-bit characters? Those were simpler times. When we needed a data buffer, we just used an AnsiString. An 8-bit character is just a byte, surely?

Then Unicode arrived and suddenly all strings were based on 16-bit characters. The code broke all around us. At the company I'm working for we needed about one year to port all our applications to Unicode. (And by “we” I mean myself. I allocated one day per week to work on Unicode issues and slowly worked through the code. Today I'd probably use AI for the task. :) )

We completed this port in Delphi 2010 times. And then we spent the next 10-ish Delphi versions fixing bugs related to this change. And when I thought we had fixed them all (hope, hope), Microsoft did something unexpected.

Monday, November 03, 2025

Restoring code formatter in Delphi 13

While I don't miss the Refactor menu in Delphi 13 -- I'm used to MMX -- I do sometimes miss ability to format Delphi code (the in/famous Ctrl+D). On my recent RAD Studio presentation in Ljubljana I learned that there are many other Delphi programmers who also miss this functionality, so I looked around to find a way of restoring it.

As it happened, I didn't have to look far. Pretty quick I found an excellent blog post written by David Cornelius. If you also miss code formatter, read his post!