Getting the default charset.

Hi,
I need to get the default charset of the platform that I am using. I found a workaround by using an InputStreamReader with the required parameters and calling getEncoding() method. After this, I can user Charset.forName(...). On Windows platform, I get "Windows-1252". That's ok.
This solution works but, maybe someone knows a simpler way to get the same information. This is what I would like to know.
Thanks !

Just been looking for exactly the same thing, so Google led me here. It also lead me to this:
http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/Charset.html
In Java 1.5 ( but not in earlier versions), the Charset class contains a defaultCharset() static method, defined when the JVM starts up.
Hope this helps.

Similar Messages

  • What is the default Charset?

    Quick questions: What is the default charset used in the String class?
    Thanks.
    Herong

    On my system, I am getting file.encoding=Cp1252. Here is some of
    the properties on my system:
    java.vm.version=1.4.1_01-b01
    java.vm.name=Java HotSpot(TM) Client VM
    java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
    os.arch=x86
    os.name=Windows 2000
    file.encoding=Cp1252
    My question was really:
    What is the Charset the JVM will use on the following statement?
    byte[] b = str.getBytes();
    Is it the same as the file.encoding?
    The API Specification only says using the platform's default charset.
    It does not tell me how to find out what is the platform's default charset.
    Thanks.
    Herong

  • How do I get the default Photostream on my MacBook Pro to match the Photostream on my iPhone and iPad?

    Essentially, I am having issues getting photos that I save on my iPhone or iPad to automatically appear on my MacBook's iPhoto app (and vice versa). The iPad and iPhone automatically share all photos between each other. I have iCloud set up and all of the photo sharing options selected on all devices, so that's not the issue. I used a bit of a workaround and created and shared a custom stream, which ultimately works. However, it involves a lot of moving photos around on all three devices, so I'd like to get the Photostream service working the way it's intended by getting the default Photostream connected to my iCloud account automatically syncing among all three devices.
    Thanks.

    Photos are kept in the My Photo Stream for 30 days or until more than 1000 have been added.  The photos will remain in the MPS for longer than 30 days if the 1000 limit is not reached.
    However, depending on when a device joined the iCloud feature and started receiving the MPS it will not see any that were added more than 30 days from the date of joining.  So if your MBP signed into iCloud and the MPS feature later than the other 2 devices it will not see photos that they might.  Also if you've turned off My Photo Stream on the MPB and then added it back it will only see the last 30 days worth.

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • How to get the default selection color from JTable

    Hi, there,
    I have a question for how to get the default selection color from JTable. I am currently implementing the customized table cell renderer, but I do want to set the selection color in the table exactly the same of default table cell renderer. The JTable.getSelectionBackgroup() did not works for me, it returned dark blue which made the text in the table unreadable. Anyone know how to get the window's default selection color?
    Thanks,
    -Jenny

    The windows default selection color is dark blue. Try selecting any text on this page. The difference is that the text gets changed to a white font so you can actually see the text.
    If you don't like the default colors that Java uses then use the UIManager to change the defaults. The following program shows all the properties controlled by the UIManager:
    http://www.discoverteenergy.com/files/ShowUIDefaults.java
    Any of the properties can be changed for the entire application by using:
    UIManager.put( "propertyName", value );

  • Trouble getting the default  user directory under Windows XP

    I m trying to get the default user directory under windows XP SP3.
    To do so, I'm using
    System.getProperty("user.home");
    I was expecting to get a path like "C:\Documents and Settings\user", nstead of that I get "C:\Documents and Settings\user\Destop".
    I checked the %USERPROFILE% and %HOMEPATH% window's environment variables and both of them are correctly set ( set to "C:\Documents and Settings\user").
    Is there any way to get the right path other than using : System.setProperty("user.home", "C:\\Documents and Settings\\user"); ?

    Thanks WalterLaan,
    The System.getenv("USERPROFILE") method will, at least, fix the problem under win XP.
    I guess i'll have to write a more refined method to be able to deploy my application under differents OSes.
    Regards.

  • Getting the default messaging app back

    i have a nokia e5-00. .bought it a few years back. .a month ago, i installed sms2.0 live app as the msging app. .it's done fine so far nw, bt i ws trying to get the default messaging app back but cant find a way to do so. There is no option to uninstall this app as it has nw become the native app for texting. Any help in this regard would be much appreciated. Thanx in advance.

    Did you try uninstalling by going to settings>application manager>installed apps>select app>select>options and select uninstall? 

  • Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?

    Where does FireFox get the default value of a preference from. What is the format of the file that has the default value?. I need the actual default value for a particualr preference.
    About:config does show some default values but I need the source from which about:config picks up the default value.
    Any help in this direction is greatly appreciated.
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    The prefs that aren't hidden if they are the default are stored in two JavaScript text files in the Firefox program folder
    You can open them via these links in a Firefox tab:
    <code>resource:///defaults/pref/firefox.js
    resource:///greprefs/all.js
    </code>
    ([/forum/1/702598])

  • Getting the default font - possible? (default fonts problem in InDesign Server CS5)

    Is there a way to decide whether a font is used as "default font" for a document?
    Or a simple way to see whether a font is used at all?
    The actual problem is that InDesign server (CS5 ver. 7.0.3.533) returns the "default font" along with all other used fonts, when looping through the document.fonts collection. This becomes a problem when the default font is never used in the document, and is also not present. Then the (name of) the default font may also become meddled by a style that does not even exist for that very font.
    This is indicated as a problem in our application... as a missing font, just as the call to InDesign server reports back. But the font (with that style) doesn't even exist.
    Running the same script on an desktop InDesign CS5 (ver 7.0.4) the unused default font of the same document is not returned at all.
    Thanks,
    Andreas

    To get the default font, just check:
    app.activeDocument.textDefaults.appliedFont
    Obviously this didn't solve the problem, since InDesign server has made up a font name that is reported as missing... and it's not equal to the default font. So there is some lack of logic in my previous description.

  • Getting the default Microphone

    Hello,
    I'm working on an audio/video conferencing app with FMS and
    Flex 2.0.1 (using Debug Flash Player 9.0.47 Mozilla/Windows Vista).
    When the client app starts, it should connect the default Camera
    and Microphone. Now, for the Camera this works fine, but I can't
    get my application to grab the default Microphone.
    According to the documentation (livedocs), if you don't pass
    an id for the Microphone, it should get you the default one. As far
    as I can tell, the default one should be the one that is selected
    when the Flash Settings dialog shows and this setting is persistent
    between different Flash sessions. Also, the reference to the
    default microphone should automatically change when the user
    changes the settings.
    However, I invariably get the Microphone with index=0. The
    code:
    var mic = Microphone.getMicrophone();
    What puzzles me is that Adobe claims that there is a way to
    get the default camera, but this seems impossible as the array of
    microphone indices is 0-based, and the argument to getMicrophone is
    an int. How does it distinguish between a call for microphone 0 and
    the default microphone?
    This has been solved better for the camera. The method
    Camera.getCamera() takes a String as an argument and this argument
    should contain the index of the camera (and not the name, as the
    documentation claims). The string can be null, in which case the
    default camera is returned.
    Does anyone know of a workaround to get the default
    Microphone? Has this been reported as a bug to Adobe?

    hi ThatGuyBS,
    Welcome to the Lenovo Forums.
    As the IdeaPad G505s uses a 2-in-1 audio jack (headphone and mic), you will need a headset splitter / adapter for a headset to work.
    If you're be using an external monophonic microphone only, you will need an extra 3.5mm Stereo male to 3.5mm Mono female adapter connected to the headset.
    Article:
    Microphone/Headset Jack - splitter needed for combo
    Sample items:
    - 3.5mm Stereo male to 3.5mm Mono female adapter
    - 3.5mm Headphone / Microphone adapter
    Alternatively, you can also use a USB microphone to elimiate getting an headset adapter.
    Regards
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Getting the default TableCellRenderer

    Hello,
    I need to get the default TableCellRender for a TableColumn. However, method getTableCellRender(TableColumn c) returns null if the the TableColumn is using the default TableCellRenderer. Is there any way to get my hands on the default TableCellRenderer?
    Thank you
    Elana

    Hi,
    TableColumnModel does not know anything about renderers. I use getCellRenderer of the JTable which contains the given TableModel. But the java api says that the the default value for the cellRederer variable is Null - which indicates that the Table is using the default renderer. I need to get that renderer somehow.
    Here is my code
              public int getPreferredWidthForColumn(TableColumn tc, JTable table){
                   int hw = columnHeaderWidth(tc, table),
                   cw = widestCellInColumn(tc, table);
                   return hw > cw? hw:cw;
              private int columnHeaderWidth(TableColumn tc, JTable table){
                   TableCellRenderer renderer = tc.getHeaderRenderer();
                   Component comp = renderer.getTableCellRendererComponent(table, tc.getHeaderValue(), false, false, 0, 0);
                   return comp.getPreferredSize().width;
              private int widestCellInColumn(TableColumn col, JTable table) {
                   int c = col.getModelIndex(), width = 0, maxw = 0;
                   for (int i = 0; i<table.getRowCount(); ++i) {
                        TableCellRenderer renderer = table.getCellRenderer(i, c);
                        Component comp = renderer.getTableCellRendererComponent(table, table.getValueAt(i, c), false, false, i, c);
                        width = comp.getPreferredSize().width;
                        maxw = width > maxw ? width:maxw;
                   return maxw;
    This was taken from the Graphic Java 2 - mastering the JFC - verbatim..
    Thank you

  • Why is the default charset is GBK , not utf-8 or GB18030  for Chinese OS???

    Why is the default charset is GBK , not UTF-8 or GB18030 for Chinese OS???
    GBK is obsolete in China.
    UTF-8 is reasonable for modern computer.

    user12833994 wrote:
    And It is none business of translating .Strings in java are UTF8. Period. Nothing else. Not ever.
    Thus input into java always becomes UTF8.
    And output starts as UTF8 and then is translated into whatever the target is.

  • Hi there,both my uncle and i are using iphone 5 that runs on 6.1.2 whenever i send or receive tweets i'am not getting the twitter default sound,i'am getting tri-tone sound.My uncle however would get the default twitter sound whenever he sends or receive.W

    Hi there,both my uncle and i are using iphone 5 that runs on 6.1.2 whenever i send or receive tweets i'am not getting the twitter default sound,i'am getting tri-tone sound.My uncle however would get the default twitter sound whenever he sends or receive.What's up with that?

    Check: Settings - Sounds - Tweet - Set to your preference.

  • I am creating a project in iDVD. There is no audio in the menus. How do u get the default music back?

    I am creating a project in iDVD. There is no audio in the menus. How do u get the default music back?

    If the theme had music associated with it originally choose a new theme and then go back to the original theme.  That will restore the audio to the menu audio bin.
    OT

  • How can I Get the default series of my UDO Document  ?

    Hi all
    I have create a new UDO (Type=Document,  ManageSeries = Yes) 
    Is there a way to get the default series of my UDO ?
    NB: I have tried the following code sample (SDK help) but it didn't work:
    Example
    [Visual Basic] The following is a VB.NET sample that retrieves the default series of a specified document type.
    Dim oCmpSrv As SAPbobsCOM.CompanyService
    Dim oSeriesService As SAPbobsCOM.SeriesService
    Dim oSeries As Series
    Dim oDocumentTypeParams As DocumentTypeParams
    'get company service
    oCmpSrv = oCompany.GetCompanyService
    'get series service
    oSeriesService = oCmpSrv.GetBusinessService(ServiceTypes.SeriesService)
    'get new series
    oSeries = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiSeries)
    'get DocumentTypeParams for filling the document type
    oDocumentTypeParams = oSeriesService.GetDataInterface(SeriesServiceDataInterfaces.ssdiDocumentTypeParams)
    'set the document type (e.g. A/R Invoice=13)
    oDocumentTypeParams.Document = "MyUDO_Code"
    'get the default series of the SaleOrder documentset the document type
    oSeries = oSeriesService.GetDefaultSeries(oDocumentTypeParams)
    'print the default series name
    Debug.WriteLine(oSeries.Name)
    'print the first number of the series
    Debug.WriteLine(oSeries.InitialNumber)
    Regards

    Hi all
    My problem is resolved
    I have find the field "DfltSeries" On the table "ONNM"
    Thanks for all

Maybe you are looking for

  • XBox 360 direct cabled to Airport Extreme...

    I thought this would be easy and straightforward, but it ain't. My Airport Extreme base station is right next to my XBox 360, so wireless is really unnecessary. I just ran an ethernet cable from the XBox to the ethernet port on the AE base station th

  • Urgent : Get OS login user in the report

    FACTS D.B 9i AS 10g Report 10g PROBLEM I implement a report where it generate a PDF output contain private employee Details and send it to his email But I want to run this report in our internal web site, Where user login by his ID to the network and

  • Unable to configure webstack - SXDE

    Noob here. Firstly, feel free to redirect if this is the wrong forum. I just installed the current release of SXDE on VMware server. I am now trying to configure the webstack, as per the Getting Started guide (as per file:///opt/webstack/doc/html/p3.

  • External flvs playing in the same component

    I'm trying to create a video gallery for a website I'm creating for a client. You can check the site out at www.leilahstar.com. The concept of the video gallery is similar to the picture gallery except when you rollover on the video thumbnail, the th

  • Error BDoc's in CRM

    Dear Experts, I have created a BP in CRM 4.0 successfully but when I verified Outbound BDoc's Using SMW01 I Found Few Error BDoc's Saying : Messages for business partner 0000111023: Make an entry in all required fields But As per my Knowledge I fille