It may be difficult to provide an example email, but we have some mail in tnef format that error as below. The mails come from English speaking folk, though in Switzerland. Also, Java does seem to support that combo ( …Locale.getAvailableLocales() ), even if it is not in the official Oracle documentation. Is there some type of work-around for this?
Using aspose-email-24.4-jdk16.jar
Could not extract the tnef contents…
com.aspose.email.system.exceptions.ArgumentException: Culture Name: en-CH is not a supported culture
com.aspose.email.internal.m.zb.c(Unknown Source)
com.aspose.email.internal.m.zb.(Unknown Source)
com.aspose.email.internal.m.zb.a(Unknown Source)
com.aspose.email.internal.ah.zc.g(SourceFile:400)
com.aspose.email.internal.m.zb.d(Unknown Source)
com.aspose.email.internal.b.zar.b(SourceFile:1178)
com.aspose.email.ContentType.(SourceFile:69)
com.aspose.email.zaqj.c(SourceFile:227)
com.aspose.email.zaqj.a(SourceFile:287)
com.aspose.email.zaqj.b(SourceFile:174)
com.aspose.email.MailMessage.b(SourceFile:1640)
com.aspose.email.MailMessage.a(SourceFile:1621)
com.aspose.email.MailMessage.c(SourceFile:1535)
com.aspose.email.MailMessage.a(SourceFile:1418)
com.aspose.email.MailMessage.load(SourceFile:1412)
@mbeedell
The error you’re encountering, “Culture Name: en-CH is not a supported culture,” suggests that the Aspose.Email library does not recognize the “en-CH” culture. While Java may support this locale, Aspose.Email may have limitations regarding the cultures it can handle.
To work around this issue, you can set the current thread’s locale to a supported culture before processing the TNEF content. For example, you can set it to “en-US” or another culture that is recognized by Aspose.Email. Here’s a code snippet demonstrating how to set the locale for the current thread:
import com.aspose.email.*;
import java.util.Locale;
public class SetCultureExample {
public static void main(String[] args) {
Locale defaultLocale = Locale.getDefault();
try {
// Set the current thread's locale to a supported culture
CurrentThreadSettings.setLocale("en-US");
// Load your TNEF content here
// For example:
// MailMessage message = MailMessage.load("path_to_your_tnef_file.tnef");
} finally {
// Restore the default locale
Locale.setDefault(defaultLocale);
}
}
}
In this example, the locale is temporarily set to “en-US” while processing the TNEF content. Make sure to restore the original locale afterward to avoid any unintended side effects.
If you continue to experience issues, consider checking the Aspose.Email documentation or forums for any updates or additional workarounds related to locale handling.
Hello @mbeedell ,
We’ll investigate the issue, and get back to you later.
@mbeedell
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): EMAILJAVA-35353
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.