Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66235

Strange prefix "ÿþh" in the mail when sourcing a value from a file

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • email-ext-plugin
    • Email Extension Plugin org.jenkins-ci.plugins:email-ext:2.83
      Jenkins 2.289.1 (This Friday is patching day and will go to latest LTS).
      OpenJDK 1.8.292, Windows.

      Hi,

      I faced an strange issue when sending emails for one of the pipelines. 

      I'm sourcing a value from a file, as it was easier way I found to inject it to mail body, nevertheless there is a prefix "ÿþh" in the mail, even do such symbols does not exist in text file I source, so it's clearly something related to the html conversion. 

      Same plugin does work fine for other mail notifications without having this prefix.

      Attaching some screenshots below. 

          [JENKINS-66235] Strange prefix "ÿþh" in the mail when sourcing a value from a file

          What is the character encoding of the file?

          Kalle Niemitalo added a comment - What is the character encoding of the file?

          Ian Williams added a comment -

          The character is "ÿþ"; the "h" is part of "https://"

          That is the byte order mark for UTF-16.

          Seems like that would make it an configuration issue in your infrastructure. Notepad hides the BOM, which is the leading character. Examine in a Hex editor. You can verify by running the Unix command

          file myfile.txt 
          

          or similar tools.

          Ian Williams added a comment - The character is "ÿþ"; the "h" is part of "https://" That is the byte order mark for UTF-16 . Seems like that would make it an configuration issue in your infrastructure. Notepad hides the BOM, which is the leading character. Examine in a Hex editor. You can verify by running the Unix command file myfile.txt or similar tools.

          Alex Pekaliev added a comment -

          File is encoded as UTF16 (LE), while jenkins config shows file.encoding CP1251. I would assume the default Windows is not UTF and Java does take system settings. 

          Will experiment later today or tomorrow and will get back.

          Thank you for your help. 

          Alex Pekaliev added a comment - File is encoded as UTF16 (LE), while jenkins config shows file.encoding CP1251. I would assume the default Windows is not UTF and Java does take system settings.  Will experiment later today or tomorrow and will get back. Thank you for your help. 

          Alex Pekaliev added a comment -

          Tried changing the encoding from the code and it worked. Seems that default behavior of powershell is to save as utf no matter what is system locale. Will discuss with the team if we shall go with an utf enabled jenkins/openjdk. 

           

          Much appreciate the help. 

          Alex Pekaliev added a comment - Tried changing the encoding from the code and it worked. Seems that default behavior of powershell is to save as utf no matter what is system locale. Will discuss with the team if we shall go with an utf enabled jenkins/openjdk.    Much appreciate the help. 

          Alex Pekaliev added a comment -

          Misconfig - powershell does save files by default as utf no matter what is set in system/jenkins. 

          Alex Pekaliev added a comment - Misconfig - powershell does save files by default as utf no matter what is set in system/jenkins. 

            Unassigned Unassigned
            onewithforce Alex Pekaliev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: