question

MEDICAL CANNABIS PRIME avatar image
MEDICAL CANNABIS PRIME asked Tyler Liu answered

Fax confirmation via email showing base64 characters

Hi,

I am using the RingCentral API to send faxes. The confirmation email that is sent via email does not contain a valid filename, but instead, shows some weird characters, as shown below:


1679360311852.png


I am using the .NET SDK as shown below:


1679360548207.png

1679360576498.png


Is this a bug with the API?

Thank you in advance!


rest apifax
1679360311852.png (136.9 KiB)
1679360548207.png (30.1 KiB)
1679360576498.png (10.4 KiB)
2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

What is the name of the file that it should be displayed? And did you send from a production or a sandbox account?

I just run a quick test and the file name displayed correctly.

0 Likes 0 ·
MEDICAL CANNABIS PRIME avatar image MEDICAL CANNABIS PRIME Phong Vu ♦♦ commented ·

In this case it was a client uploading a file so I do not know the exact name, but it is using the FileInfo.Name property, which will never be base64 encoded like this.


This happens in production.

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered MEDICAL CANNABIS PRIME commented

I can now confirm that if the name of a file is in unicode, the filename will not be rendered correctly in the fax transmission result email. There seems no solution for this. So the only way to avoid that problem is to change the name to something else not in unicode chars.

6 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

MEDICAL CANNABIS PRIME avatar image MEDICAL CANNABIS PRIME commented ·

Thank you for your response, I had a feeling this was a bug.

Are there any workarounds? The .NET SDK uses a string for the filename, and not a byte array, which is always natively Unicode, I believe.

I can try to hack something like this together, but not sure it will work:

 new string(Encoding.UTF8.GetBytes(file.Name).Select(b => (char)b).ToArray())
0 Likes 0 ·
Phong Vu avatar image Phong Vu ♦♦ MEDICAL CANNABIS PRIME commented ·

In fact, I tried this but it did not fix the problem at all. It looks the same so I guess that the system converts unicode to UTF-8 string too.

private string UnicodeToUTF8(string strFrom)
{
    byte[] bytes = System.Text.Encoding.Default.GetBytes(strFrom);
    return System.Text.Encoding.UTF8.GetString(bytes);
}

I don't think your solution would work either.

0 Likes 0 ·
MEDICAL CANNABIS PRIME avatar image MEDICAL CANNABIS PRIME Phong Vu ♦♦ commented ·

Exactly what I thought. What can we do to correct this issue then?

0 Likes 0 ·
Show more comments
Tyler Liu avatar image
Tyler Liu answered

The issue can be reproduced with the official app. Just send a fax with a file with Chinese characters in the filename, such as [some-chinese-characters-here].txt. (this forum doesn't support Chinese characters, if I include some, the post cannot be published at all.)

The email notification will display the filename as %E6%B5%8B%E8%AF%95.txt

I believe it is a bug of the program which sends out the email notification. It cannot handle non-ascii characters.


1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys