Saturday, February 14, 2026

The continuing story of converting a database to Unicode

Last week's episode1 concluded with the successful migration of badly encoded Hebrew from one table to the Unicode database. The next day, I tried converting another table to Unicode and hit a wall: this table contained some character fields but as they did not have (and will not have) any Hebrew in them, there was no need for the painful conversion code. But the migrator tried to convert them anyway, resulting in error messages.

When is a door not a door*, or rather, when is a string field not a Hebrew string field? Basically, there's no way of knowing, as SQL databases don't offer such meta-information. In the end, after a great deal of to-ing and fro-ing, I and CoPilot hit upon the following scheme: an external file will be maintained where the lines contain a <table name>.<field name>=<code page> structure. Only fields found in this file will be converted. The code page is important as it forces the correct encoding to be used. At the moment, it looks like everything should be encoded as WIN-1255 but I can't take the risk of assuming that every Hebrew field is 1255. Specifically the list looks like this:

accumulations.name=1255 ACTIVITIES.NAME=1255 calls.subject=1255 calls.details=1255

Don't take this as meaning that there are only four Hebrew text fields in the database! At the moment of writing this, I've only successfully converted two tables (accumulations and activities) and that was after a great deal of hard work. I wanted to see whether the sixth table (in alphabetical order) would pose any problems, as this table has two character fields that need converting and at least one more that does not need converting.

And this is when I hit another problem: there is a date field in this table, but every attempt to convert it results in an error. To quote CoPilot, 

Today you uncovered the key detail we needed: the source field is a TSQLTimeStampField, which means FireDAC is always handing you a timestamp, even when the SQL type is DATE. That’s the heart of the whole mystery, and tomorrow we can finally untangle it cleanly.

When you’re fresh again, we’ll sort out:

  • how to reliably detect true DATE columns
  • how to bypass FireDAC’s timestamp mapping
  • how to force DATE‑only semantics even when the Delphi field class lies to you

You’re much closer to the finish line than it feels right now.

Unfortunately, after about an hour of butting my head against a wall, it seems that there is no option but to define the field in the new table as a timestamp. What does CoPilot have to say about this? Given everything you’ve tried — and everything FireDAC has refused to do — switching the column to TIMESTAMP is not a workaround. It is the correct engineering decision. You will save yourself hours of frustration, and your code will become simpler and more robust.

Similar but much more easily solved problems were encountered with numerical fields and blobs. Eventually all the problems of the first six tables were ironed out, and at the same time I improved certain aspects of the actual convertor program. I asked CoPilot to create a summation document of the entire process that I have saved. It's slightly more terse than I would have prepared but otherwise it's fine.

Now all I have left (he wrote hopefully) is the mechanical work involved in converting the remaining 104 tables. There shouldn't be any more surprises as all the main data types have been encountered.

(*) When is a door not a door? When it's ajar.

Internal links
[1] 2070



This day in blog history:

Blog #Date TitleTags
33314/02/2011Idea for startupFood science, Startup
54914/02/2013Another evening (2)MIDI
81014/02/2015Changes in fortuneDBA
81114/02/2015Ordinary peopleFilms
100714/02/2017A certain kind of academic recognitionERP

Friday, February 13, 2026

Not a successful band practice

Unusually we had a rehearsal last night, a Thursday evening. I prefer this to Saturday evening, as I don't have to get up early on the following morning - although, as I often remind myself, in another six months I won't have to get up early on any day, let alone Sunday. I suppose that from the band's point of view it was a good rehearsal but it wasn't for me.

The 'fx pedal to end all pedals1' issues a fair amount of noise so in order to combat this, I set the noise gate to a level that let loud guitar through but not hiss. This caused the guitar to sound rather 'chunky' and lacking dynamics. Thinking about this on the way home, I realised that all the presets that I defined start with compression; maybe it would be better to create some presets with no compression and see what these sound like.

If I'm talking about that fx box, then I should note that the Reddit discussion that I mentioned at the end led to a site from which software could be downloaded. This wasn't too useful, but it did give me the name of the app that I needed to download to my phone that controls the box. I turned the box's bluetooth on then paired it with my phone: the app allows one to choose a preset, define settings for that present then save them. Although the app is slightly clumsy, it's better than defining the presets on the box itself. Maybe one day I'll go down to the rehearsal room on my own, connect everything then try out various sounds before committing them to a preset.

If the sound problems weren't enough, at the beginning of one song - piiiing - the top E string snapped! I had to play a few songs with 5-string guitar that definitely changes the sound. Only the bass player noticed. I am loathe to break yet another set of strings in order to extract a single string but I don't have much option. As it happens, I was at the music shop in Bet Shemesh a few days ago when I asked the owner to put the high G string on my 12 string guitar; the string had snapped shortly after adding it2. I should ask whether he has spare single strings for sale. 

Another minor problem: the plectrum holder had broken while it was in the gig bag, so I had to find the two picks buried deep inside the bag. The little holder on this guitar has often given me problems in the past, but now it is totally useless (the spring inside has broken). These things only cost a few shekels but I would prefer to pay more money in order to have something more robust. At the moment, my primary plectrum is wedged in the time honoured fashion between the bottom three strings in the headstock.

We're starting a month long break due to rehearsals for the Purim show in which several band members are involved, so I have plenty of time to sort out the problems with the guitar and the fx box.

Add to all these external problems the fact that I had some form of stomach ache, and one can understand why from my point of view this wasn't a successful band practice.

Internal links
[1] 2072
[2] 2042



This day in blog history:

Blog #Date TitleTags
45213/02/2012GatewayGateway
67313/02/2014A flaw with spreadsheetsERP, DBA, Excel
92613/02/2016ERP thoughtsDBA
158313/02/2023Putting words into actionIsrael
190313/02/2025Bug in PrioXRefProgramming