Re: SOLVED - Re: Putemail - subject contains utf-8 chars - the result is lot of question marks

2023-08-22 Thread Mark Payne
Fantastic! Thanks for confirming, István. I filed a Jira [1] to add this by 
default to bootstrap.conf.

Thanks
-Mark

[1] https://issues.apache.org/jira/browse/NIFI-11977




On Aug 22, 2023, at 10:00 AM, Pongrácz István 
mailto:pongracz.ist...@gmail.com>> wrote:

Hello Mark,

Thank you very much for your quick reply!
I confirm, your solution fixed the problem, now I got beautiful utf-8 
characters in the subject, too :)

Probably include this trick in the documentation [1]  would be nice and/or the 
default bootstrap.conf could include this settings.

Regarding to the question about the mail body:
In general, it was working with my characters.
The content type did not matter, text/plain or text/html, both of them are 
working.
(Please note, I did not write 'text/plain;charset=utf-8'  nor  
'text/html;charset=utf-8' )

The html content contains the , but I do not think it does matter.



Thank you!
István

[1] 
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.1/org.apache.nifi.processors.standard.PutEmail/index.html



2023. 08. 22, kedd keltezéssel 13.29-kor Mark Payne ezt írta:
Hey István,

The PutEmail processor is using Jakarta Mail as the underlying library. Based 
on some googling, I found a Stack Overflow issue [1]
with similar concerns. The recommendation there is to set a system property to 
specify mail.mime.charset. Can you try doing that?
To do so, you’d update conf/bootstrap.conf and add a new line to the bottom of 
the file:

java.arg.mail.charset=-Dmail.mime.charset=UTF-8

Unfortunately, that does require a restart of NiFi. Am interested to know if 
that helps, though.

One question for you: you mentioned that the subject is incorrect, but what 
about the message body? Do you have UTF-8 characters in the message body
that are also incorrect? Or does the message body appear to be fine?

Thanks
-Mark

[1] 
https://stackoverflow.com/questions/15044027/utf-8-charset-doesnt-work-with-javax-mail


On Aug 22, 2023, at 8:59 AM, Pongrácz István 
mailto:pongracz.ist...@gmail.com>> wrote:

Hi,

I would like to send out email with utf-8 chars in the subject, usingputemail.
Technically it is working fine, except the utf-8 chars in the subject changed 
to '?' characters.

Example:
I wrote the following into the subject: Hűvös van íűáéúőóüö

The result is:
H?v?s van ?

The source of the receiverd email looks like this:

Subject: =?ANSI_X3.4-1968?Q?H=3Fv=3Fs_van_=3F=3F=3F=3F=3F=3F=3F=3F=3F?=

This seems a little bit unprofessional.

Do I miss something trivial? I guess, I just missed something with the 
environment (locales?).

I tried to find expression language possibility to do something with the 
subject or character encoding, but I failed. As I remember, nifi uses utf-8 and 
doesn't really care about character encoding conversion.

I did not change too much in the environment (nothing, barebone debian 11).

I use the following:
Debian 11 + Nifi 1.20


root@nifi10:~# locale -a

C

C.UTF-8

POSIX

root@nifi10:~# java -version

openjdk version "11.0.16" 2022-07-19

OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)

OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed mode, 
sharing)


Could you give me a hint, where to find a solution? I would like to use utf-8 
chars instead of ascii.

Thank you!

István




SOLVED - Re: Putemail - subject contains utf-8 chars - the result is lot of question marks

2023-08-22 Thread Pongrácz István
Hello Mark,

Thank you very much for your quick reply!
I confirm, your solution fixed the problem, now I got beautiful utf-8
characters in the subject, too :)

Probably include this trick in the documentation [1]  would be nice
and/or the default bootstrap.conf could include this settings.

Regarding to the question about the mail body:
In general, it was working with my characters.
The content type did not matter, text/plain or text/html, both of them
are working.
(Please note, I did not write 'text/plain;charset=utf-8'  nor
 'text/html;charset=utf-8' )

The html content contains the , but I do not think it does matter.



Thank you!
István

[1] 
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.1/org.apache.nifi.processors.standard.PutEmail/index.html



2023. 08. 22, kedd keltezéssel 13.29-kor Mark Payne ezt írta:
> Hey István,
> 
> The PutEmail processor is using Jakarta Mail as the underlying
> library. Based on some googling, I found a Stack Overflow issue [1]
> with similar concerns. The recommendation there is to set a system
> property to specify mail.mime.charset. Can you try doing that?
> To do so, you’d update conf/bootstrap.conf and add a new line to the
> bottom of the file:
> 
> java.arg.mail.charset=-Dmail.mime.charset=UTF-8
> 
> Unfortunately, that does require a restart of NiFi. Am interested to
> know if that helps, though.
> 
> One question for you: you mentioned that the subject is incorrect,
> but what about the message body? Do you have UTF-8 characters in the
> message body
> that are also incorrect? Or does the message body appear to be fine?
> 
> Thanks
> -Mark
> 
> [1] 
> https://stackoverflow.com/questions/15044027/utf-8-charset-doesnt-work-with-javax-mail
> 
> 
> > On Aug 22, 2023, at 8:59 AM, Pongrácz István
> >  wrote:
> > 
> > Hi,
> > 
> > I would like to send out email with utf-8 chars in the subject,
> > usingputemail.
> > Technically it is working fine, except the utf-8 chars in the
> > subject changed to '?' characters.
> > 
> > Example:
> > I wrote the following into the subject: Hűvös van íűáéúőóüö
> > 
> > The result is:
> > H?v?s van ?
> > 
> > The source of the receiverd email looks like this:
> > Subject: =?ANSI_X3.4-1968?Q?H=3Fv=3Fs_van_=3F=3F=3F=3F=3F=3F=3F=3F=3F?=
> > 
> > This seems a little bit unprofessional.
> > 
> > Do I miss something trivial? I guess, I just missed something with
> > the environment (locales?).
> > 
> > I tried to find expression language possibility to do something
> > with the subject or character encoding, but I failed. As I
> > remember, nifi uses utf-8 and doesn't really care about character
> > encoding conversion.
> > 
> > I did not change too much in the environment (nothing, barebone
> > debian 11).
> > 
> > I use the following:
> > Debian 11 + Nifi 1.20
> > 
> >root@nifi10:~# locale -a
> >C
> >C.UTF-8
> >POSIX
> >root@nifi10:~# java -version
> >openjdk version "11.0.16" 2022-07-19
> >OpenJDK Runtime Environment (build 11.0.16+8-post-Debian-1deb11u1)
> >OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Debian-1deb11u1, mixed 
> > mode, sharing)
> >
> > Could you give me a hint, where to find a solution? I would like to
> > use utf-8 chars instead of ascii.
> > 
> > Thank you!
> > 
> > István
>