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] 
> <javascript:>> 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.
> loading));
>
>                        }
>
>                        @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;
>
>                        }
>
>                        @Override
>
>                        protected void onPostExecute(Object result) {
>
>                                if (DebugHandler.LOG_ENABLED) {
>
>                                        DebugHandler.log(this, "LOADED " + 
> (result != null) + " " + mType);
>
>                                }
>
>                                if (result != null) {
>
>                                        if (mType == TYPE_WEB) {
>
>                                                try {
>
>                                                        String encoding = 
> UTF_8;
>
>                                                        String data = 
> URLEncoder.encode((String) result, encoding).replaceAll("\\+", " ");
>
>                                                        DebugHandler.log(
> this, "Before "+encoding+" encoding: "+result+"\nAfter "+
>
> ...

-- 
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/be927ed5-f67c-4172-a2aa-b7237dcd24b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to