Aspose fails to initialise with some locales


#1

Hi there,

We’re having troubles where Aspose fails to initialise, depending on the locale data that we initialise with.

For example, the following example in Java:

License slidesLicence = new License();
slidesLicence.setLicense(new ByteArrayInputStream(LICENCE_DATA.getBytes(StandardCharsets.UTF_8)));
Locale.setDefault(new Locale("en", "KR"));
String[] fontDirs = {};
FontsLoader.loadExternalFonts(fontDirs);

throws this exception

Culture Name: en-KR is not a supported culture

We’re seeing this in the following products:

  • aspose_email: [‘com.aspose:aspose-email:18.3:jdk16’],
  • aspose_pdf: [‘com.aspose:aspose-pdf:18.3’],
  • aspose_slides: [‘com.aspose:aspose-slides:18.2:jdk16’],
  • aspose_words: [‘com.aspose:aspose-words:18.3:jdk16’],

There’s a similar thread that mentions this was fixed, but it doesn’t appear to be the case, based on our testing: Culture Name: en-RS is not a supported culture 1496


#2

@nuix,

I have observed your requirements and like to share that Aspose APIs support standard locales supported by Java platforms. Therefore, by design java.lang.IllegalArgumentException: Culture Name: xx-XX is not a supported culture is used for the wrong Locale. I hope the shared information will be helpful.


#3

Hmm, I see.

The problem with this is that generally in Java applications, when an unrecognised locale is encountered, the standard behaviour is to fallback to the parts of the locale that are recognised. This behaviour is described in http://hwellmann.blogspot.com/2010/02/misconceptions-about-java.html

Whereas Aspose has no fallback behaviour, so instead it just comes to a halt and throws that exception. We consider this a bug.

This is causing an issue for our users who have their operating system settings in a “non-standard” combination, for example – language: English, country: Korea. The only part of our application that is having trouble with this combination is Aspose.

In order to work around this limitation in Aspose, we’re looking at forcing the locale of Aspose to “en-US” when this initialisation error occurs.

Unfortunately, we’re having trouble finding the appropriate methods to set the locale for each Aspose library. Could you help with that?

Locale.setLocale is impractical for us because we’re in a multithreaded environment. Also, because we only want to override Aspose’s processing language, not the language used in our user interface.

For aspose.words we can see CurrentThreadSettings.setLocale, which is great for this workaround, as we can restrict the changes to a single thread. It’s great.

For aspose.cells, we can see LoadOptions.setLocale, which seems to be suitable for this workaround as well.

However! For the following APIs, I couldn’t find a setLocale method at all:

  • aspose.cad
  • aspose.diagram
  • aspose.email
  • aspose.imaging
  • aspose.pdf
  • aspose.slides
  • aspose.note

Do these libraries have locale-setting functionality in the API, and if so, could you please let me know which methods we can use?

Thanks!


#4

@nuix,

Thank you for sharing the feedback. We have created following enhancement tickets in our issue tracking system to further investigate the possibility of providing requested support in other APIs as well.

  • For Aspsoe.PDF PDFJAVA-37857 has been created.
  • For Aspsoe.Diagram DIAGRAMJAVA-50611 has been created.
  • For Aspsoe.Slides SLIDESJAVA-37157 has been created.
  • For Aspsoe.Imaging IMAGINGJAVA-1043 has been created.
  • For Aspsoe.CAD CADJAVA-352 has been created.
  • For Aspsoe.Notes NOTEJAVA-465 has been created.
  • For Aspsoe.Email EMAILJAVA-34394 has been created.

We will share feedback with you as soon as the associated issues will be addressed.


#5

The issues you have found earlier (filed as DIAGRAMJAVA-50611) have been fixed in this update. This message was posted using BugNotificationTool from <a href=“https://#{request.env[“HTTPS_HOST”]}”>Downloads module by Farhan.Raza


#6

Hi Mudassir,

Just to clarify – which fix will be implemented in these enhancement tickets?

Thanks!


#7

@nuix,

I have observed your comments and like to share that at present the concerned implementation has not been done in any of associated API. However, we have updated the information shared by you in concerned Jira tickets and will share the feedback with you as soon as the issues will be fixed.


#8

The issues you have found earlier (filed as PDFJAVA-37857) have been fixed in Aspose.PDF for Java 18.8.


#9

The issues you have found earlier (filed as IMAGINGJAVA-1043) have been fixed in this update.