Results 1 to 14 of 14
  1. #1
    RR_QQ is offline Member
    Join Date
    Sep 2008
    Posts
    25
    Rep Power
    0

    Default Reading strings with like "degree symbol" - HOW?

    OK so I am reading a string from a URL object by opening up a BufferedReader. Some characters in the string are like say the degree circle symbol (730′10″S 11115′47″E). but the text is spit out like this: 7°30′10″S 111°15′47″E.

    Any Idea how to fix this???? I would like it to be correctly read. Thanks a lot!

  2. #2
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    8

    Default

    Well the unicode for the degrees symbol is \u00B0.. Not sure if this helps though.
    -MK12
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  3. #3
    RR_QQ is offline Member
    Join Date
    Sep 2008
    Posts
    25
    Rep Power
    0

    Default

    hmmmm I don't think so haha....see its not just symbol I will need to take care of so it has to be dynamic.......????

  4. #4
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    9

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    22

    Default

    Quote Originally Posted by RR_QQ View Post
    hmmmm I don't think so haha....see its not just symbol I will need to take care of so it has to be dynamic.......????
    Anyway, what's wrong working with UNICODE?

  6. #6
    MK12's Avatar
    MK12 is offline Senior Member
    Join Date
    Jan 2009
    Posts
    185
    Rep Power
    8

    Default

    I think he means that he can't manually replace everything with unicode chars to fix, he has to make it work by itself since its getting the String from a source external to the program.
    Tell me if you want a cool Java logo avatar like mine and I'll make you one.

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,370
    Blog Entries
    1
    Rep Power
    22

    Default

    So this string is generated dynamically.

    I wonder one thing. In that string we can find the double quote sign ". How can it gives a annoying character to the output. Even in ASCII format it should correctly displayed, as letters are displayed.

  8. #8
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    10

    Default Great Link...

    MCN... that's a really good link...

    Thanks,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    28

    Default

    I'm wondering what the original poster means by "spitting out". Just how are you displaying the read-in String? In a console window? If so, you may be running up against a font limitation of the console and may need a GUI to display this properly.

  10. #10
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    10

    Default

    "... but the text is spit out ..."
    ... maybe the program's saliva gummed up some of the characters... :)

    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  11. #11
    RR_QQ is offline Member
    Join Date
    Sep 2008
    Posts
    25
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I'm wondering what the original poster means by "spitting out". Just how are you displaying the read-in String? In a console window? If so, you may be running up against a font limitation of the console and may need a GUI to display this properly.
    Sorry I missed all the posts I went away for the weekend. Ok yes I am using a console window and perhaps you are right about font limitation. Let me try to display text in a GUI and see what happens.

  12. #12
    RR_QQ is offline Member
    Join Date
    Sep 2008
    Posts
    25
    Rep Power
    0

    Default

    Ok...there is one problem how exactly do I test this with a GUI? I think there is so much text that a this is throwing out an exceptions:

    Java Code:
    JTextArea outputArea = new JTextArea();
    outputArea.setText(htmlText);
    JOptionPane.showMessageDialog(null, outputArea, "Test Output", JOptionPane.INFORMATION_MESSAGE);
    It takes forever to finish before it throws out the error/exception:

    Java Code:
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    	at java.awt.image.DataBufferInt.<init>(Unknown Source)
    	at java.awt.image.Raster.createPackedRaster(Unknown Source)
    	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
    	at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
    	at java.awt.Component.createVolatileImage(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component.createBufferStrategy(Unknown Source)
    	at java.awt.Window.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent.paint(Unknown Source)
    	at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
    	at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    	at java.awt.Container.paint(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    	at java.awt.image.DataBufferInt.<init>(Unknown Source)
    	at java.awt.image.Raster.createPackedRaster(Unknown Source)
    	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
    	at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
    	at java.awt.Component.createVolatileImage(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component.createBufferStrategy(Unknown Source)
    	at java.awt.Window.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent._paintImmediately(Unknown Source)
    	at javax.swing.JComponent.paintImmediately(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    	at java.awt.image.DataBufferInt.<init>(Unknown Source)
    	at java.awt.image.Raster.createPackedRaster(Unknown Source)
    	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
    	at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
    	at java.awt.Component.createVolatileImage(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component.createBufferStrategy(Unknown Source)
    	at java.awt.Window.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent._paintImmediately(Unknown Source)
    	at javax.swing.JComponent.paintImmediately(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    	at java.awt.image.DataBufferInt.<init>(Unknown Source)
    	at java.awt.image.Raster.createPackedRaster(Unknown Source)
    	at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
    	at sun.awt.image.SunVolatileImage.getBackupImage(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.getBackupSurface(Unknown Source)
    	at sun.awt.image.VolatileSurfaceManager.initialize(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.image.SunVolatileImage.<init>(Unknown Source)
    	at sun.awt.windows.WComponentPeer.createVolatileImage(Unknown Source)
    	at java.awt.Component.createVolatileImage(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.createBackBuffers(Unknown Source)
    	at java.awt.Component$BltBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component$BltSubRegionBufferStrategy.<init>(Unknown Source)
    	at java.awt.Component.createBufferStrategy(Unknown Source)
    	at java.awt.Window.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.createBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager$BufferInfo.getBufferStrategy(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.prepare(Unknown Source)
    	at javax.swing.BufferStrategyPaintManager.paint(Unknown Source)
    	at javax.swing.RepaintManager.paint(Unknown Source)
    	at javax.swing.JComponent._paintImmediately(Unknown Source)
    	at javax.swing.JComponent.paintImmediately(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Exception occurred during event dispatching:
    java.lang.OutOfMemoryError: Java heap space
    Any thoughts?

  13. #13
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    9

    Default

    really, i think you're just reading the data in with the incorrect encoding. did you try out anything from the link i posted? i'm not sure if it's completely related, but i ran into similar trouble with a project i had last year

  14. #14
    RR_QQ is offline Member
    Join Date
    Sep 2008
    Posts
    25
    Rep Power
    0

    Default

    I appreciate your help. I read over what you posted. Not sure it relates except for the part of the String text = new String( bytes, charset ); but not sure if that is really related.

    The way I'm reading the text from the URL is wiht a BufferedReader to which I pass an InputStreamRearder(url.openSTream) to the constructor of the BufferedReader. Then I read each liken with a while ((inputLine = in.readLine()) != null).

    By "reading the data in with teh incorrect encoding" do you mean I have to set the encoding type somehow for the BuffferedReader or do you mean I need to use a different type of reader? Please remember I'm java ignorant ;)

Similar Threads

  1. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  2. Replies: 1
    Last Post: 01-23-2009, 05:13 PM
  3. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  4. printing an "E" out of asterisks via strings
    By hokieman07 in forum New To Java
    Replies: 1
    Last Post: 04-08-2008, 05:45 AM
  5. "Cannont find symbol Constructor" error
    By Welsh in forum New To Java
    Replies: 7
    Last Post: 01-25-2008, 01:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •