Thursday, January 15, 2004

More IDE secrets - UTF8 and the Editor 


In C#Builder and Delphi8, the code editor operates internally on UTF8 characters only. This requires a "filtering" mechanism to translate from/to various other text file formats when the file is loaded or saved. These are the "filters" you can select by right-clicking in the editor and selecting the encoding from the menu. By default, the editor will store the file as locale-specific ANSI encoding which can lead to a potential loss of character data if a file from another locale using a different code-page were loaded and saved. You can change the default encoding of the files to always be UTF8 by setting the following key:

C#Builder: HKCU\Software\Borland\BDS\1.0\Editor
Delphi 8: HKCU\Software\Borland\BDS\2.0\Editor

DefaultFileFilter="Borland.FileFilter.UTF8ToUTF8"

Using UTF8 encoding when operating on a file in memory instead of straight UCS-2 (Unicode) was done for efficiency, not only in implementation time, but also in terms of memory usage. The editor kernel already knew how to manage middle- and far-eastern multibyte codepages, so extending the kernel to simply treat UTF8 as simply another multi-byte encoding was a relatively trivial excercise. Also, since the vast majority of source files contain only characters from the 0-127 ASCII range, each character will remain a single byte. Only embedded strings and comments would typically have extended (>128) characters. Also, UTF8 conversion is a very fast bit-level transform without the need for look-up tables. This allows the editor painting code to do a simple quick transform into UCS-2 and then use the Unicode APIs for painting the text. This way, a file created from one locale will render correctly when opened and edited in another locale since the UTF8/Unicode character space includes encodings for all languages.

0 comments

Wednesday, January 14, 2004

Commenting.. 


I've gone ahead and added commenting to this blog. It is currently hosted by HaloScan, which is a free comment hosting site. Eventually, this whole sha-bang, will move to using a Borland provided blogging and commenting system. For now I'll stick with what is already out there and available.
2 comments

Sunday, January 11, 2004

Where's Waldo... er... Allen? 


It's been close to a month since my last blog entry and a *lot* of stuff has happened since then, both personal and corporate. On the corporate front, Delphi 8 for .NET was released to manufacturing on Dec 19, 2003. This is great news because it meant we were able to take advantage of the two-week corporate shut-down.

On the personal front, I lost a very dear person in my life. On December 30th, my mother succumbed to lung cancer. This was quite a shock to my family as she has never smoked a day in her life. However, I am truly thankful that I was able to be with her for her last few days and was by her side the moment she passed along with my wife, sister and brother-in-law. She will be sorely missed. So, until our spirits meet again, bye Mom...

The next few weeks are going to be interesting as we begin execution and planning for the next product releases. I will try and keep things going here, but there will certainly be many distractions as the meeting counts increase and while we slog through the details of planning product cycles.

0 comments

Disclaimer:
The opinions expressed here are mine. They should in no way be construed as being the opinion of my employer, Borland Software Corp. If you actually think that my opinions are a reflection of Borland, then I have a bridge I can sell you.

Subscribe to my RSS feed.

This page is powered by Blogger. Isn't yours?