I have some data that includes a \0 byte in it, and that seems to be valid UTF8 data:
using System;
using System.Text;
public class Program
{
public static void Main()
{
byte[] b = new byte[3];
b[0] = 65;
b[1] = 66;
b[2] = 0;
Console.WriteLine(Encoding.UTF8.GetString(b));
}
}
That code works fine. But, when trying to update a record in Postgres, it complains about it:
22021: invalid byte sequence for encoding "UTF8": 0x00
The data shouldn't be there, but how can it be that one system accepts it, and another doesn't? I reckon they both implement standards.