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
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Problem in showing non english characters in browserfield

Hi,

I have read many posts regarding displaying non-english characters in browserfiled.I have tried encoding UTF8 but the characters like  àèòìù causing problem in display.

 

Can somebody help me?

 

Regards

Rujuta Trivedi
Please use plain text.
Developer
simon_hain
Posts: 16,044
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Problem in showing non english characters in browserfield

does a normal desktop browser display the html correctly?
if not, fix that :smileyhappy:
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: Problem in showing non english characters in browserfield

Hi Simon,the problem- the original text is è un and it is displaying è un . Any idea of the issue?
Rujuta Trivedi
Please use plain text.
Developer
lakshman9687
Posts: 243
Registered: ‎07-22-2011
My Device: BlackBerry Z10
My Carrier: AirTel

Re: Problem in showing non english characters in browserfield

Hi,

Can you post your code snippet here, how you are encoding in UTF-8.

 

Can u try this code

byte [] inputBytes = null;
try 
{
     inputBytes = response.getBytes("UTF-8");
            		
} 
catch (Exception e) 
{
     System.out.println("");
}
response = new String(inputBytes);

 Regards,

Lakshman K

----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: Problem in showing non english characters in browserfield

Hi,
I have used this code

try {
final byte[] dataByteArray = dataString.getBytes("UTF-8");
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
_resultBrowser.displayContent(dataByteArray, "text/html; charset=UTF-8", "");
}
});
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

I have also tried your code and its displaying  Ãfè.

 

 

Regards

Rujuta Trivedi
Please use plain text.
Developer
simon_hain
Posts: 16,044
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Problem in showing non english characters in browserfield

is the html correctly displayed in a desktop browser?
is it in utf-8?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: Problem in showing non english characters in browserfield

Yes,it is correctly displayed in desktop browser.Actually its an email and I am displaying html content in browserfield.It is displaying perfectly fine with blackberry native email client but not with my custom one.
Is there anyway to resolve this or display html email content in other way?
Rujuta Trivedi
Please use plain text.
Developer
simon_hain
Posts: 16,044
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Problem in showing non english characters in browserfield

our code is similar:
byte[] utfByte = mail.getBody().getBytes("UTF-8");
final String utfString = new String(utfByte);
browserField.displayContent(utfString, "");

mail is a custom object that contains the html body.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: Problem in showing non english characters in browserfield

Hi Simon,

Its still displaying the same result. Just to clarify mail.getBody() means the mail object- message.getBodyText() or mimepart.getContent() ? I have tried both but its displaying same result.

 


Rujuta Trivedi
Please use plain text.
Developer
trivedirujuta
Posts: 528
Registered: ‎10-06-2009
My Device: 9800,BB Dev Alpha,z10 limited edition
My Carrier: Vodafone

Re: Problem in showing non english characters in browserfield

Hi Simon,
Can you please help me out with this?
Rujuta Trivedi
Please use plain text.