Re: decode, base64 problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gmail Vladimir Koković <vladimir(dot)kokovic(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: decode, base64 problem
Date: 2020-05-22 15:57:13
Message-ID: 29545.1590163033@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

=?UTF-8?Q?gmail_Vladimir_Kokovi=c4=87?= <vladimir(dot)kokovic(at)gmail(dot)com> writes:
> I don't know what this is about, so I could get from someone who knows
> more PostgreSQL than I do,

base64 translates groups of three bytes into groups of 4 characters, so
you can't just randomly chop the result at spots that aren't multiples of
4. Even if the result happens to look like valid base64 data, the decode
output would be wrong, with bits incorrectly reassembled into bytes.

I'd recommend decoding the whole base64 string and then substring'ing
the result of that.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2020-05-22 16:04:51 Re: decode, base64 problem
Previous Message gmail Vladimir Koković 2020-05-22 15:49:08 decode, base64 problem