pvaneynd: (Default)
2017-03-30 09:05 am
Entry tags:

20 years of UNICODE for the win?

As some of you know I'm back to coding. This morning I was trying to create a SQL table which failed with mysterious errors, like:

DB=> CREATE TABLE sequence (
 sequence_id INTEGER NOT NULL,
 guid_id INTEGER REFERENCES public.guid(id),
 sequence_number INTEGER NOT NULL);
ERROR:  relation "public.guid" does not exist
Time: 3.007 ms
DB=> \dt guid
        List of relations
 Schema | Name | Type  |  Owner
 public | guid | table | pevaneyn
(1 row)

I was suspecting a hidden character, so od to the rescue:

$ od -c failing-command
0000140   i   d       I   N   T   E   G   E   R       R   E   F   E   R
0000160   E   N   C   E   S     357 273 277   g   u   i   d   (   i   d

Octal 357 273 277? Clearly this is UTF-8 encoding of something invisible. Let's use clisp:

[3]> (aref (EXT:CONVERT-STRING-FROM-BYTES (vector #o357 #o273 #o277) CUSTOM:*TERMINAL-ENCODING*) 0)

Ok an invisible space got inserted somewhere along the line... At least I'm not getting mad and forgetting basic SQL :)
pvaneynd: (Default)
2010-09-10 07:19 am
Entry tags:

OIPE events and dates

I've started hacking OIPE again after complaints that 'our pictures are not visible for me!'.

So I've added events exporting and I've just found a way to decode the date format used in the database from here. It's so weird floating point format, centered on 1/1/2000 (!).