Ticket 
created: https://github.com/couchbase/couchbase-lite-java-core/issues/277
Demo project is at https://github.com/chrisdon/CBLHtmlAttachScramble

On Tuesday, August 26, 2014 4:48:01 PM UTC+1, Traun Leyden wrote:
>
> Yes, that would be useful.
>
> Also can you move this to a github ticket?
>
> https://github.com/couchbase/couchbase-lite-java-core
>
>
>
>
> On Tue, Aug 26, 2014 at 8:24 AM, Chris Donnelly <[email protected] 
> <javascript:>> wrote:
>
>> Hey Traun,
>>
>> Have you been able to reproduce the problem?
>>
>> If not, I can put up a project on github that demonstrates the issue.
>>
>>
>>
>> On Wednesday, August 13, 2014 4:20:00 PM UTC+1, Chris Donnelly wrote:
>>
>>> Apologies, the IP address of the server has changed. Url is now 
>>> http://54.75.156.177:5984/_utils/database.html?public
>>>
>>> On Wednesday, August 13, 2014 4:15:22 PM UTC+1, Traun Leyden wrote:
>>>
>>> I tried to pull it and it's not responding.
>>>
>>> Can you check the server?
>>>
>>>
>>> On Mon, Aug 11, 2014 at 6:13 AM, Chris Donnelly <[email protected]> 
>>> wrote:
>>>
>>> Hey Traun,
>>>
>>> Thanks for the response.
>>>
>>> I upgraded CBL to the latest master branch and got the same result.
>>>
>>> I've put the document and attachment on a public db -  
>>>
>>> http://54.74.66.56:5984/_utils/database.html?public
>>>
>>>
>>>
>>> On Thursday, August 7, 2014 4:41:41 PM UTC+1, Traun Leyden wrote:
>>>
>>>
>>> Hey Chris, thanks for reporting this.  Unfortunately, nothing is ringing 
>>> a bell as to why this might be happening.
>>>
>>> For the purposes of possibly isolating the issue, would it be possible 
>>> for you to re-test against the latest master branch version of the 
>>> couchbase lite code?
>>>
>>> See https://github.com/couchbase/couchbase-lite-android#
>>> getting-the-pre-built-jars--maven-artifacts or https://github.com/
>>> couchbase/couchbase-lite-android#zipfile-that-includes-jars for 
>>> instructions.  
>>>
>>> Another angle that might be productive is if you could put this document 
>>> + attachment on a publicly accessible CouchDB server (eg, on IrisCouch or 
>>> Cloudant) and I can try to sync with a Couchbase Lite instance in our test 
>>> lab.
>>>
>>>
>>>
>>>
>>> On Thu, Aug 7, 2014 at 1:37 AM, Chris Donnelly <[email protected]> 
>>> wrote:
>>>
>>>
>>>
>>> I've recently upgraded the android app I'm working on from an old 
>>> unsupported version of CBL Android to version 1.0.1. 
>>> The app replicates to/from a CouchDB (v1.5) instance using the 
>>> Replication class where with the old CBL I used the Ektorp API.
>>>
>>> When I fetch a locally stored Document with an html attachment, the 
>>> output is scrambled as per below:
>>>
>>> Before utf-8 encoding: 
>>>
>>> uSMo@W?=4JG"BġV8c{ٝMuM$>X|y/.gq*J -;g2ú7Ӽ~dSJoa`uO0vlJ1Dr27_ 
>>>
>>> 1
>>>
>>> OhKj1AOp-*
>>>
>>> #zNHyYd٢[ޒҨaondNgB4J"G$ep4Ld&pFzrYګv+
>>>
>>> r~
>>>
>>> ,14`,1<WnREI
>>>
>>> uhtlG2g-F|3j9TJk†?̒McŃ34kOh;qkOmJxJFʹSȊpZ#-ƋÒ.]?Tw%w<-c=6ͭS
>>>
>>> p\|q&yaߠ{hUjMO씱eIVTI
>>>
>>> tX\>!?7u!%
>>>
>>> After utf-8 encoding: %1F%EF%BF%BD%08%00%00%00%00%00
>>> %00%03uSMo%EF%BF%BD%40%10%EF%BF%BDW%EF%BF%BD%3F%0C%3D4%12J%
>>> 13%EF%BF%BDG%1A%22%EF%BF%BDB%C4%A1%EF%BF%BD%EF%BF%BDV%EF%
>>> BF%BD8%EF%BF%BD%EF%BF%BDc%7B%EF%BF%BD%EF%BF%BD%D9%9DM%EF%BF%BD%10%EF%BF%BD 
>>> etc etc..
>>>
>>> Relevant code is below:
>>>
>>>
>>>          /**
>>>
>>>         * Load an attachment from the Couch database and set the result 
>>> in the view on the UI thread. Two views are currently supported, {@link 
>>> WebView} for HTML and {@link ImageView} for pngs
>>>
>>>         *
>>>
>>>         * @param view
>>>
>>>         * @param activity
>>>
>>>         * @param portalItemBase
>>>
>>>         */
>>>
>>>        public static void loadAttachment(final View view, final Activity 
>>> activity, final PortalItemBaseNode portalItemBase, final String 
>>> inAttachmentID) {
>>>
>>>                AsyncTask<Void, Void, Object> task = new AsyncTask<Void, 
>>> Void, Object>() {
>>>
>>>                        private ProgressDialog progress;
>>>
>>>                        private static final int TYPE_WEB = 1;
>>>
>>>                        private static final int TYPE_IMAGE = 2;
>>>
>>>                        private static final int TYPE_IMAGE_SCALEABLE = 3
>>> ;
>>>
>>>                        private int mType;
>>>
>>>                        private Matrix imageMatrix;
>>>
>>>                        @Override
>>>
>>>                        protected void onPreExecute() {
>>>
>>>                                if (view instanceof WebView) {
>>>
>>>                                        mType = TYPE_WEB;
>>>
>>>                                } else if (view instanceof ImageViewTouch
>>> ) {
>>>
>>>                                        mType = TYPE_IMAGE_SCALEABLE;
>>>
>>>                                } else if (view instanceof ImageView) {
>>>
>>>                                        mType = TYPE_IMAGE;
>>>
>>>                                }
>>>
>>>                                progress = ProgressDialog.show(activity, 
>>> activity.getString(R.string.please_wait), activity.getString(R.string.lo
>>> ading));
>>>
>>>                        }
>>>
>>>                        @Override
>>>
>>>                        protected Object doInBackground(Void... arg0) {
>>>
>>>                                String dbName = SevenCityApplication.
>>> getModel().getSelectedSitting().getDatabaseName();
>>>
>>>                                String attachmentName = 
>>> getFirstAttachmentName(portalItemBase);                         
>>>
>>>                                InputStream in = SevenCityApplication.
>>> getModel().getSyncer().getAttachment(dbName, portalItemBase.getId(), 
>>> attachmentName);
>>>
>>>                                if (in != null) {
>>>
>>>                                        if (mType == TYPE_WEB) {
>>>
>>>                                                String result = "";
>>>
>>>                                                try {
>>>
>>>                                                        result = 
>>> inputStreamAsString(in);
>>>
>>>                                                        in.close();
>>>
>>>                                                } catch (IOException e) {
>>>
>>>                                                        e.printStackTrace
>>> ();
>>>
>>>                                                }
>>>
>>>                                                return result;
>>>
>>>                                        } else if (mType == TYPE_IMAGE || 
>>> mType == TYPE_IMAGE_SCALEABLE) {
>>>
>>>                                                Bitmap b = BitmapFactory.
>>> decodeStream(in);
>>>
>>>                                                try {
>>>
>>>                                                        in.close();
>>>
>>>                                                } catch (IOException e) {
>>>
>>>                                                        e.printStackTrace
>>> ();
>>>                                                                         
>>>                       }
>>>
>>>                                                return b;
>>>                                                                         
>>>     }
>>>
>>>                                }
>>>
>>>                                return null;
>>>
>>>                <span style
>>>
>>> ...
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Couchbase Mobile" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/mobile-couchbase/cdb404b0-62de-48fd-bd62-cebf501ed21e%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/mobile-couchbase/cdb404b0-62de-48fd-bd62-cebf501ed21e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/20a9f1e3-ad14-4179-973f-586f58e75b2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to