Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Visitor
Posts: 1
Registered: ‎08-31-2011
My Device: bold
My Carrier: vivo

UnsupportedAttachmentPart decode getName()

Hello.

 

The following code works gracefully.

 

String rawFileName;

if (part instanceof SupportedAttachmentPart) {
  SupportedAttachmentPart supportedAttch = (SupportedAttachmentPart) part;
  rawFileName = supportedAttch.getFilename();
} else if (part instanceof UnsupportedAttachmentPart) {
  UnsupportedAttachmentPart unsupportedAttch = (UnsupportedAttachmentPart) part;
 rawFileName = unsupportedAttch.getName();
}

// rawFileName, if is from UnsupportedAttachmentPart is messed no matter how I try to decode it.

 

The problem starts when the attached file name is not in english.

 

If the name of attached file is "ęóąśłżźćń.docx" and I get it on SupportedAttachmentPart and decode the name in UTF-8, I can read it in the right way.

 

But, if i get the same file on UnsupportedAttachmentPart and decode in UTF-8 the name of the file is not OK, its messed.

 

* I have the language installed on my phone.

* I tried to decode in various formats, none worked.