You need to sign in to do that
Don't have an account?
MSong
"BLOB is not a valid UTF-8 string" Issue
Hi Everyone,
I found a great solution online which allows to email a report from SF to non-SF users - http://kevindotcar.wix.com/home/apps/blog/how-to-schedule-a-report-to-send
This worked great until the report had non-english characters which is causing an issue.
VF email template is used and when the report has non-english characters, it displays the error message of "Error occurred trying to load the template for preview: BLOB is not a valid UTF-8 string. Please try editing your markup to correct the problem." at the top of the page.
Here's the code for VF template
Appreciate your help in advance!!
I found a great solution online which allows to email a report from SF to non-SF users - http://kevindotcar.wix.com/home/apps/blog/how-to-schedule-a-report-to-send
This worked great until the report had non-english characters which is causing an issue.
VF email template is used and when the report has non-english characters, it displays the error message of "Error occurred trying to load the template for preview: BLOB is not a valid UTF-8 string. Please try editing your markup to correct the problem." at the top of the page.
Here's the code for VF template
<messaging:emailTemplate subject="Data Export" recipientType="User" > <messaging:plainTextEmailBody > Hi, please find attached the report(s) you have requested... Kind regards, {!$Organization.Name} </messaging:plainTextEmailBody> <messaging:attachment filename="report.csv" > <c:ReportExportController xstrRptname="00OR0000000kUFo"/> </messaging:attachment> </messaging:emailTemplate>Here's the code for ReportExportController.
<apex:component controller="CSVStream" access="global"> <apex:attribute name="xstrRptname" description="report ID" type="String" assignTo="{!strRptname}"/> <apex:outputText value="{!CSVStream}" escape="false"/> </apex:component>Here's the code for CSVStream.
public class CSVStream { public static Boolean isTest; public static String strEmailAddr; public static String strOut; public static Boolean restRequested; public String strEmail{get;set;} public String strRptname{get;set;} void CSVStream () { strOut = ''; } public String getCSVStream() { restRequested = System.isFuture() || System.isScheduled(); executeRpt(); return strOut; } public void executeRpt() { String requestURL; requestURL = '/' + strRptname + '?csv=1&exp=1'; strOut = new PageReference(requestURL).getContent().toString(); System.debug('CALLING executeRpt: output= ' + strOut ); } }Does anybody have an idea how to fix this?
Appreciate your help in advance!!
I know I'm answering late, and you prolly figured it out, but on this line;
Change it to:
All Answers
I know I'm answering late, and you prolly figured it out, but on this line;
Change it to:
Glad to help!
Thank you so much, I was using the same code as mSong and ran into the same issue!