-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachment Name does not show Norwegian Characters #19
Comments
Hello @PrinceVarshney, I believe you are asking for us to update the dependency in sendgrid-java to support v4.1.0 of this library. Correct? If so, here is the ticket for that: sendgrid/sendgrid-java#162 -- I will add your vote to that issue to grant it higher priority. With Best Regards, Elmer |
Hei @thinkingserious Please help!! |
Hello @PrinceVarshney, I'm not sure what is causing that issue, I am attempting to clarify with you. Let me make sure my assumptions are correct:
Also, can you please provide me with the sample file so that I can try to re-create the issue? Thanks! Elmer |
Yeah I am using sendgrid-java SDK v3.1.0. We are creating runtime content and the name of the pdf visible to the user is that should be This is where I am attaching the file Attachments attachments=new Attachments(); While sending it through sendgrid : |
Hello @PrinceVarshney, I was unable to reproduce the error, here is the code I used: import com.sendgrid.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Example {
public static Mail buildHelloEmail() throws IOException {
Email from = new Email("[email protected]");
String subject = "Hello World from the SendGrid Java Library";
Email to = new Email("[email protected]");
Content content = new Content("text/plain", "some text here");
Mail mail = new Mail(from, subject, to, content);
Attachments attachments = new Attachments();
attachments.setContent("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4gQ3JhcyBwdW12");
attachments.setType("application/pdf");
attachments.setFilename("Pris og oppgjørsvilkår.pdf");
attachments.setDisposition("attachment");
attachments.setContentId("Balance Sheet");
mail.addAttachments(attachments);
return mail;
}
public static void baselineExample() throws IOException {
SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
Request request = new Request();
Mail helloWorld = buildHelloEmail();
try {
request.method = Method.POST;
request.endpoint = "mail/send";
request.body = helloWorld.build();
Response response = sg.api(request);
System.out.println(response.statusCode);
} catch (IOException ex) {
throw ex;
}
}
public static void main(String[] args) throws IOException {
baselineExample();
}
} Perhaps the value in |
Hey @thinkingserious |
Yes, I am using the latest version 3.1.0. Can you check the encoding on your source code editor? |
Will it matter. ? I think you are talking about eclipse. ? Whats the use of below line ? sg.addRequestHeader("X-Mock", "true"); |
That line can be ignored, it is for when we use our local testing server. I just tried without that line with the same result. For Eclipse: http://stackoverflow.com/questions/9180981/how-to-support-utf-8-encoding-in-eclipse |
My request in the logs is printed correctly : so does the eclipse encoding will matter.. ? |
I'm not sure. Can you please try sending your test email to [email protected]? |
I have sent one mail on this id. One thing I observed that the issue is with MicrosoftOutlook only, in gmail its fine. |
Hello @PrinceVarshney, I have received the email correctly in GMail. Since the filename is correct on your server and in GMail, it appears the issue is with Outlook and that it might be a known problem. I'm going to leave this issue open for further investigation. Perhaps there is some header that Microsoft Outlook requires to ensure UTF-0 encoding. |
Hey @thinkingserious I need to have some workaround for the same, as most of the clients of our projects are using Outlook only. |
Hello @PrinceVarshney, I have added this to our backlog for further review. |
Hi @PrinceVarshney, Can you please try:
Thanks! Elmer |
Will try this and will inform you regarding the same. Thanks!! |
Hey @thinkingserious This is not working. This is giving =utf-8QPris=20og=20oppgj=C3=B8rsvilk=C3=A5r.pdf Thanks |
Hello @PrinceVarshney, What version of Outlook are you using? |
Can you email me with your Outlook email address so I can try sending a test to you? |
@thinkingserious |
@thinkingserious |
Hey Its working I attached this MimeUtility.encodeText("string", "UTF-8", "Q") mail.setAttachmentName(MimeUtility.encodeText("Pris og oppgjørsvilkår.pdf", "UTF-8", "Q")) First we have to encode it as per Q-encoded |
That's awesome and thanks for sharing the solution! I'm going to keep this ticket open so that we can add this to the SDK. For your efforts, we would like to offer you some swag. Please fill out this form for us :) |
Thank you !! Will fill the form once outside office network :) |
Since there has been no activity on this issue since March 1, 2020, we are closing this issue. Please feel free to reopen or create a new issue if you still require assistance. Thank you! |
Issue Summary
I am new to SendGrid, I wanted to send a mail with attachment having Norwegian characters in the name. Receiver is receiving the mail but the name contains Å instead of Ø. Saw the Client class , it contains the change for UTF characters
sendgrid-java v3.1.0 is being used. Not using the java-http-client. I visited few related issues but was not able to get which api version include this change. Its urgent for me as we are going in production in two weeks.
Please help!
The text was updated successfully, but these errors were encountered: