Commit 929b4231 authored by Kevin Falcone's avatar Kevin Falcone
Browse files

Document _DecodeLOB. Improve the _EncodeLOB docs

In particular, call out their return and expected values in case you're
trying to pass the return from _DecodeLOB back into _EncodeLOB, which
RT::Migrate does.
parent 750bdd77
......@@ -736,6 +736,14 @@ EncodedBody, MimeType, Filename) based on system configuration and
selected database. Returns a custom (short) text/plain message if
DropLongAttachments causes an attachment to not be stored.
Encodes your data as base64 or Quoted-Printable as needed based on your
Databases's restrictions and the UTF-8ness of the data being passed in. Since
we are storing in columns marked UTF8, we must ensure that binary data is
encoded on databases which are strict.
This function expects to receive an octet string in order to properly
evaluate and encode it. It will return an octet string.
=cut
sub _EncodeLOB {
......@@ -807,6 +815,27 @@ sub _EncodeLOB {
}
=head2 _DecodeLOB
Unpacks data stored in the database, which may be base64 or QP encoded
because of our need to store binary and badly encoded data in columns
marked as UTF-8. Databases such as PostgreSQL and Oracle care that you
are feeding them invalid UTF-8 and will refuse the content. This
function handles unpacking the encoded data.
It returns textual data as a UTF-8 string which has been processed by Encode's
PERLQQ filter which will replace the invalid bytes with \x{HH} so you can see
the invalid byte but won't run into problems treating the data as UTF-8 later.
This is similar to how we filter all data coming in via the web UI in
RT::Interface::Web::DecodeARGS. This filter should only end up being
applied to old data from less UTF-8-safe versions of RT.
Important Note - This function expects an octet string and returns a
character string for non-binary data.
=cut
sub _DecodeLOB {
my $self = shift;
my $ContentType = shift || '';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment