From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/18088 Path: news.gmane.org!.POSTED!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: Pandoc Error with Rmarkdown and Shiny Date: Fri, 25 Aug 2017 07:15:08 -0700 Message-ID: <20170825141508.GA26975@Johns-MacBook-Pro.local> References: <1c67925b-ebef-4e18-ba6d-477292e07160@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed X-Trace: blaine.gmane.org 1503670523 26131 195.159.176.226 (25 Aug 2017 14:15:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 25 Aug 2017 14:15:23 +0000 (UTC) User-Agent: Mutt/1.6.2 (2016-07-01) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCJZJHG45QDBB6PBQDGQKGQESO7Y3WY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Aug 25 16:15:17 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-pg0-f61.google.com ([74.125.83.61]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dlFOF-0006RC-SB for gtp-pandoc-discuss@m.gmane.org; Fri, 25 Aug 2017 16:15:17 +0200 Original-Received: by mail-pg0-f61.google.com with SMTP id 83sf748912pgb.2 for ; Fri, 25 Aug 2017 07:15:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1503670522; cv=pass; d=google.com; s=arc-20160816; b=AZ2HYyRdgkaTUYLtIHqZ0U9t+an4B1zBAFmlDBCUcg/7lOqgs0qTDSKax/EEptnvmH LSrk7wZ+hilGtl/HKcMh5jVMtKOLJEOYj/BFS7Z4ip7TkW6YfdyJigV9uPTQJzEZtl/c U6r/tKvNTJpYGMr8UuksfofN+S/jYDTmxeSl5sleiMYhsspINKMKAd+Df/YaKVNjRvhb 2e/ovYejTC+F8FFWz+TowC2PU0xKLcJUuOZ+oLYYQxS4n5lhxkLmJlk8bqpKbXEQy422 dmt4JDFUDt3yV3/V/xnzMz1hJkBUl0m6T/sxSxJKXJbhDIsDfPtQlcr+zXbp4Xu+SCuL mEDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:to :date:from:arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=hoUY+1SwVH+q9cHXnioy+ZMrlDqeDBCfB0I2vIcw1ew=; b=O1gbHCCNydAd3USafocVXBS0XmFTFoV7XXWL75eUUPUb+3e0R2makm+xu29VV2BAOw kboXUH6dftWT0tze4eHBl4iT75Svct50kNaP3LGmcnebfV1GSRsEf/SFjPizamlKkqiA eG0rFSxJEDLHFYpRQ30QCSfbbzVuwmwtjUbuaQs+jfunFsliaDlERL4leLEIZwx+rxi+ xoyCy+PwL2CeCrVE7WusrbTizYQHocdq6shoHWkCTJ5ODr4TgoUUX1BAZ3ohI9e85pJp UA1fi+44Vqryt3O8wktEe5iBC2rT2UMM28hHG52b/yINYTqQ6krc4SU6BBPnkdLrypJT ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Xwkx47KU; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c05::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:date:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=hoUY+1SwVH+q9cHXnioy+ZMrlDqeDBCfB0I2vIcw1ew=; b=JjOSCgI2vPJjYTK7QRBE8kzQIvQXs85MAMDp4ME8bYnKP072ClORdxtJM3Bqbj6p/h HMzYxkPe7HndZdtLy5k7ZPJHH2RFS5PzSavLTFXjns6s8EuL9xr/hbub2+p2yITC5uyl a1Niamc4KvdjkdvL8olIa1NIDnEvzcCCUYk+7T1YiY/uObnkktjxA03cKotpy82E3p36 2UzU7k+lvyFy9vKenTYCfk2vH37JoUzYpLTww6XT+2X75L0m4/eCG+WgJedYTEpGVZ5O LvFusY1AvERKC/eKZkQBSStsFalxwcacnOiPaRrvwK+oIVehy2vKErwPzMjI9RErAJd/ DXzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:date:to:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=hoUY+1SwVH+q9cHXnioy+ZMrlDqeDBCfB0I2vIcw1ew=; b=d9yareXOBlPXKgkXOuqBOswLB8/4ILDd8xEbbeuQLNOeh6Y7ymC0h6vmZ2a2FxsO9P x5XcAJ1FHmS5O9rArsrMeT84twiJ1sTFQhA/x/Tvq6mFxSkGOVy88sKRfZc9yrwEfHCO T6NKnxRBuZuUhyZAlvGVg/fdigLYxD0Ch2Pggk3mf2ya3UeVFz6fdlIPvWXJzYX/50e1 Ji89UQq3klF18JprNKN1OaDWnIJFULbcGWZONXs4OkJH5QuhfGOHcBEa/8N7hFA8y4us TIj1FyVH6pss72SLSROaUecQ62IDKpD7rlo58Yz5rXG1t6GxzVLn6u+zMHhSeVRLXDX/ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AHYfb5h77q2YZb77sB1VOrhb5+w11exH8ZFdzXCCDo81CgUXibHLO6gx XZolRThlAIrqOA== X-Received: by 10.36.14.5 with SMTP id 5mr87360ite.14.1503670522476; Fri, 25 Aug 2017 07:15:22 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.36.18.76 with SMTP id 73ls777053itp.22.canary-gmail; Fri, 25 Aug 2017 07:15:21 -0700 (PDT) X-Received: by 10.176.75.100 with SMTP id i36mr6258917uaf.39.1503670521599; Fri, 25 Aug 2017 07:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503670521; cv=none; d=google.com; s=arc-20160816; b=Qn1I77NUijYVykDH3X4r5JIpvwm0DvKw7L7IiqKpTcDFwv5EabhRkjQz5dgCjnVCJI Ku/qDG2z5LuWLCzhWejZJmubJlswE/cN8rswwuj+uRHx/GgutO/IBJtH7n9IZ7uPolSf kd4lQTVShR+nYknSDTkIFwq9+XIT+MbYP25tTpFeEn6jNrOtied4U3BKb5bxMOH94bQF VMtpkmN5lsO0E81j3yjWGterigh3J84OBfRlZMBOMYDAyyJ8AMn4LkImN/gy0DhMIaS5 +KfcAmcEqnhafa75K0f63ivpWAAXxYdPdsY6cFGFrWTtNvMwcIEOFM2chxBVv1oZaAPE lvhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:to:date:from:dkim-signature :arc-authentication-results; bh=p5GNEeR07sIBA1K1/VHDbrqlls63BnO4bupV7oL+pmI=; b=W5AAtk1qNBjIuNlVU9PLyGLnnfr27evFKGOVnDQ/F2hNzPu0/QbttBKzn5Pe/26cWy VWXnj6Qhe8Cz1MjdbCu+P6uq2FHpzzJlzNGNiFNRWPBOdAwQbaGxqdQmd7EeAyY9FJIF +Fqp5ID0j7LsFkHQC4ZomDyhg3W5P2PIMzJZl4jRkLT4D64EQ9PNFeNGrT4chjxfTexZ gJT6+iSDclQH7SY3PMAYDGyKBUg8MFnV91wGsIlUctmg8FPhsDwdBdR+kcYQiQx8bLTh LMoI9saRslrN2n24ZEdEbUbhctlr3wfFaqMYLDIMWDQF+chf/GB+LAzTFuavuflPFVIl E7Ew== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Xwkx47KU; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c05::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com. [2607:f8b0:400e:c05::241]) by gmr-mx.google.com with ESMTPS id b9si1130043pfm.20.2017.08.25.07.15.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Aug 2017 07:15:21 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c05::241 as permitted sender) client-ip=2607:f8b0:400e:c05::241; Original-Received: by mail-pg0-x241.google.com with SMTP id a7so4057621pgn.4 for ; Fri, 25 Aug 2017 07:15:21 -0700 (PDT) X-Received: by 10.84.247.23 with SMTP id n23mr10913430pll.451.1503670520777; Fri, 25 Aug 2017 07:15:20 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id e12sm11286756pgu.73.2017.08.25.07.15.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Aug 2017 07:15:19 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id B61CBA1C5; Fri, 25 Aug 2017 10:15:07 -0400 (EDT) Content-Disposition: inline In-Reply-To: <1c67925b-ebef-4e18-ba6d-477292e07160-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-PGP-Key: http://johnmacfarlane.net/jgm.asc X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=Xwkx47KU; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:400e:c05::241 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:18088 Archived-At: Pandoc expects its input to be UTF-8 encoded text, and complains in this way if it is not. Probably your script is using a different text encoding for the downloaded report_file.html. (Or, if this is downloaded, perhaps it's not UTF-8 encoded on the server.) You need to make sure it's UTF-8 encoded before passing it to pandoc or rmarkdown::render. (I speak without knowing what rmarkdown::render does, but I assume it just calls pandoc and doesn't do any encoding.) +++ Andrew Scotchmer [Aug 25 17 01:24 ]: > Hi > I have a simple R shiny app. Whenever I try and download the table I > created I get the following error: > pandoc: Cannot decode byte '\xfe': > Data.Text.Internal.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream > Warning: Error in : pandoc document conversion failed with error 1 > Stack trace (innermost first): > 53: pandoc_convert > 52: convert > 51: rmarkdown::render > 50: download$func [/home/scotcan1/Webshot/app.R#50] > 1: shiny::runApp > Error : pandoc document conversion failed with error 1 > I don't know what this means. Here is my R/Shiny script and > Rmarkdown. > R: > library(shiny) > library(DT) > data(iris) > ui <- fluidPage( > > titlePanel("|Species Table"), > > sidebarLayout( > sidebarPanel( > selectInput("specs", > "Number of bins:", > unique(iris$Species)), > downloadButton("download", "Download Report") > ), > > mainPanel( > tableOutput("specTable") > ) > > ) > > ) > server <- function(input, output) { > > subSpec <- function(x){ > testdat <- iris[iris$Species == x, ] > return(testdat[1:10,]) > } > > reactiveFunction <- reactive({ subSpec(input$specs) }) > > > output$reactiveTable <- renderDataTable({ reactiveFunction() }, > rownames = FALSE) > > output$specTable <- renderUI({ > dataTableOutput("reactiveTable") > > }) > > > > output$download <- downloadHandler( > filename <- "report_file.html", > > content <- function(file){ > write.csv(reactiveFunction(), "test_csv.csv", row.names = FALSE) > params <- list(data = reactiveFunction()) > rmarkdown::render(filename, output_file = file) > } > ) > } > shinyApp(ui = ui, server = server) > Rmarkdown: > --- > title: "Untitled" > output: html_document > params: > data: NA > --- > ```{r, echo=FALSE} > data(iris) > library(DT) > datatable(params$data) > ``` > Any help to interpret the error appreciated. > Andrew > > -- > You received this message because you are subscribed to the Google > Groups "pandoc-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [1]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to > [2]pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > [3]https://groups.google.com/d/msgid/pandoc-discuss/1c67925b-ebef-4e18- > ba6d-477292e07160%40googlegroups.com. > For more options, visit [4]https://groups.google.com/d/optout. > >References > > 1. mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 2. mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 3. https://groups.google.com/d/msgid/pandoc-discuss/1c67925b-ebef-4e18-ba6d-477292e07160-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org?utm_medium=email&utm_source=footer > 4. https://groups.google.com/d/optout