How to set the character encoding in Blackberry

Hello

In my application, I get the data using http server methods...

now my question is that, in that the data is seen some like that

ex: Córdoba, but inside, I do not like this...

After some R and D, I thought that I have to set the character encoding...

can someone tell me how to set the character encoding and how I can get all languges in my application

See below the code for reference

 HttpConnection c = null;
                    InputStream is = null;
                    DataOutputStream os = null;
                    int rc;
    c = (HttpConnection)Connector.open("http://10.10.10.00012:8585CountryDatar;deviceside=true;");
                            c.setRequestMethod(HttpConnection.POST);
                            c.setRequestProperty("If-Modified-Since", "29 Oct 1999 19:43:31 GMT");
                            c.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.0");
                            c.setRequestProperty("Content-Language", "en-US");
                           /* Getting the output stream may flush the headers */

                            os = (DataOutputStream)c.openDataOutputStream();
                            byte[] res = net.rim.device.api.system.GPRSInfo.getIMEI();
                            os.writeUTF(net.rim.device.api.system.GPRSInfo.imeiToString(res));

                            os.flush();
                            /* Optional, getResponseCode will flush
                                Getting the response code will open the connection,
                                send the request, and read the HTTP response headers.
                                The headers are stored until requested.
                            */
                            rc = c.getResponseCode();

                            if (rc != HttpConnection.HTTP_OK) {
                               throw new IOException("HTTP response code: " + rc);
                            }

                            is =(DataInputStream)c.openDataInputStream();
                             byte[] data1 = new byte[256];
                             int len = 0;
                             int size = 0;

                            int ch;
                            StringBuffer sb = new StringBuffer();
                           while ( -1 != (len = is.read(data1)) )
                           {
                                sb.append(new String(data1, 0, len));
                            }                

                         data = sb.toString();       //Here data is a string storing all data came from server

Give us a break please.  I have other things to do!

You set the encoding here:

SB. Append (new String (data1, 0, len));

Most of the servers give you UTF - 8, but you know that.  Anyway, if it is UTF - 8 follow these steps:

SB. Append (new String (data1, 0, len, "UTF - 8"));

Tags: BlackBerry Developers

Similar Questions

  • How to set the Anti Aliasing in Blackberry Storm?

    I m drawing in a bitmap as...

    bitmap[i] = new Bitmap(60, 60);
    Graphics g = new Graphics(bitmap[i]);
    g.setColor(Color.BLACK);
    g.drawLine(....);
    

    Now how to put Anti-Aliasing on before g.drawLine ()?

    Try again with the addition of this before drawline:

    g.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, true);
    

    Concerning

    Bika

  • How to set the first character as selections in the EditField.

    Hi friends,

    I am a third-party application that I have to set the first character as capital.

    so please help me how to set the first tank as capital.

    Take a look at AutoTextEditField - maybe you can use this to do it automatically...

  • BlackBerry smartphone how to set the Auto Mode bedside when loading?

    Hi guys,.

    As the topic. How to set the Auto Mode bedside when loading? Because this option, it does not exist in the clock menu options and I think that it was there before I did the upgrade.

    Thanks in advance

    9000 "BOLD"

    Worm: 9000M_PBr4.6.0_rel508_PL4.0.0.243_A4.6.0.297_AT_amp_T

    CTS network provider

    solved thanks to you all,.

  • How to set the background Transparent

    Hi all

    I'm very new to blackberry development, can someone tell me how to set the background transparent.

    Thank you

    Kishore P.

    Use this code:
    VFM VerticalFieldManager = new VerticalFieldManager () {}
    //...
    }
    vfm.setBackground (BackgroundFactory.createSolidTransparentBackground (Color.COLOR_YOU_LIKE, 0));

  • How can set the background color of the status bar?

    Quote from the old forum:

    Comments: comments
    How can set the background color of the status bar?
    Posted the: July 17, 2008 02:56
     
    How can set the background color of the status bar?
    Using this code for the status bar:
    LabelField statusField = new LabelField ("Good Morning", LabelField.USE_ALL_WIDTH |) LabelField.NON_FOCUSABLE | LabelField.HCENTER)
    {
    int _backgroundColour = Color.LIGHTGREEN;
    public void paint (Graphics g)
    {
    g.setBackgroundColor (Color.RED);
    g.Clear ();
    Super.Paint (g);
    }
    };

    Font defaultfont = Font.getDefault ();
    Police smallfont = defaultfont.derive (Font.PLAIN, 12);

    statusField.setFont (smallfont);
    setStatus (statusField);

    When I ran the code you have above, my status background color was red.  Is not what you see?  If so, please provide the BlackBerry model and software version that you are testing.  You can find this under Options.

    Or if you try to do something else, please provide details.

    I tested this in the BlackBerry Simulator included with version 4.5.0 BlackBerry JDE (4.5.0.44).

    To do this in version 4.1, first call getColor and save the current color.  Then call setColor, setting the color to the color you want to use for the background.  After this call call fillRect, starting with 0, 0 and go to the size of the field (use this.getWidth () and this.getHeight () to get this).  This must fill in the field with your specified color.

    To allow the drawing of the default content of the field call setColor once again, passing in the original color, then call super.paint.

  • How to set the font "ARIAL" family in the RichTextField?

    How to set the font "ARIAL" family in the RichTextField?

    I saw a LOF of the sample displayed how set the font family in the RichTextField, such as defined as CBTF_FONT.

    But how can I put it as Arial font? If it cannot be, anyone could list a family table of fonts available for use in the Blackberry?

    You are right, for these devices you can use fonts already on the device.

  • How to set the dependency?

    Hi, I created two projects in the framework still a draft package is based on another medium he uses this project with the class. I am therefore unable to build the project.  In the samples under folder browser 'BrowserFieldDemo' and 'commonlib' of projects with the same addiction they began compiling correctly.  But iam unable to set the dependency it please tell me how to set the dependency.

    My project folder structure:

    com\adea\blackberry

    -Project1

    ------------------------File1

    ------------------------File2

    -project2

    ------------------------File1

    ------------------------File2

    Thanks and greetings

    Sunil.G

    Set the type of project that will be used by another project like 'library '.

    And this library project will be available for you to create dependencies.

    http://picasaweb.Google.com/tbilisoft/BlackberryForum#5275894851814275858

  • How to set the content of the column for lines of automatic separation

    Hello guys,.

    I have a problem with the column width and the content of column in a standard report. In the report are hugh entries that are not interrupted by a space character. I put my column width to a special value by usingen "style css: display block; Width: 300px; ». Now the problem is that some of the entries in the column with a longer width that the column width is set. Then they overlock the entries in the column next to them.

    My question is: How to set the column lines of automatic content break after a certain number of characters?

    After searching for a couple of websites and discussion thread, I found maybe a reference to the solution. I hope that it helps you to give me an answer.

    A4 FORMAT LAST_NAME COLUMN
    */*

    concerning

    wderr

    Wderr,

    It is more a matter of HTML as a matter of APEX... You can start by looking here:
    http://www.456bereastreet.com/archive/200704/how_to_prevent_html_tables_from_becoming_too_wide/

    Kind regards
    Dan

    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • How to set the number of e-mail messages that are stored on my iPhone

    How to set the number of e-mail messages that are stored on my iPhone – so when I don't have a network connection I can see a 'large' number of messages in my Inbox etc.

    This is series is not defined in the world

    You must go to settings-> mail, contacts, and calendars and check the settings of your e-mail provider offers in this area

  • Why, after all these years, can not Thunderbird automatically detect the character encoding

    Judging by all existing messages and complaints on this issue, not to mention the erroneous messages that say that the problem is resolved when it is not, I must conclude Mozilla either does not believe it is a problem or doesn't care to fix it. The key is that there is no way to tell Thunderbird to automatically display the emails in the character encoding format that they were written in. I could understand the case where headers are not properly filled, but I see tons of emails in which coding is clearly in the headers in the message source. You can force, but if you do the menu VIEW-> encoding-> UTF8 character (for example) it doesn't 'glue' If you post another message. But who wants him 'stick' at all times even when? What the average user really wants is to be able to toggle the VIEW-> character encoding-> auto detect the default 'off' value simply "on" and don't have to bother with it more.

    This is a problem that seems to go on forever, and it NEVER happens with other e-mail clients. If there is some backdoor way to actually autodetect working, I would know about it. But more importantly, I think that all users would appreciate it if this was not some secret arrangement 'backdoor', but a choice of menus overall simple for all accounts. Can Mozilla if you please fix this problem once and for all?

    Can you tell us what you heard:
    Tools > Options > advanced > general tab
    Click on Config Editor

    At the top of the search page of type:
    Mailnews.force_charset_override; Value = "false".

    Do you like value... true or false?
    If Value = 'True', double click on the line to switch to "false".

    close window - top right X
    Click OK to save the changes to the Options.
    Close and reopen Thunderbird.

  • Where is the character encoding option in 29.0.1?

    After the change of the new provision, the menu Developer do not have character encoding options more where the hell is that? He drives me crazy...

    Hello tyw214, there is a dedicated button for the character encoding that you can add to your menu customization mode: controls, buttons, and Toolbars Customize Firefox

  • How to set the time that my screen stays on?

    How to set the time that my screen lights up.  I have an iPod Touch 6?

    Settings > general > auto-lock

  • How to set the default android home page.

    How to set the home page in the latest browser of firefox for android?

    Hello:

    Unfortunately you can not remove the top sites home page but you can pin a site, remove a site from unpin it and change the url of a pinned site.

    Please read this article for instructions.

    I hope this helps!

  • How to set the time between slides in a slideshow (iPhoto, el capitan)

    How to set the time to say - 5 seconds or 20 seconds - between slide show photos in iPhoto. I use el capitan.

    See the Settings button at the bottom right of the toolbar (at the bottom of the slide show). Click on it and you have a small window with two tabes, refers to all the slides, the other to the selected slide. You can make your choice

Maybe you are looking for