There's lots of thins that can happen to make it seem like ActiveMQ is
not doing the right thing.  For example:
1) The FileWriter encodes the string to the file using the java
default platform encoding.
2) If you then view the file in your terminal, you then have to check
what encoding the terminal is using.

Typically, #1 and #2 do not match.

I'd recommend setting up a little test case to test to see of the
character in question is being preserved.

On Tue, Nov 5, 2013 at 5:50 PM, belaie <[email protected]> wrote:
> Hello
>
> I'm reading a que from ActiveMQ using ActiveMQ java client.  I'm have
> problem reading norwegian characters such as Å,Æ, Ø from message body in the
> que,    anyone can help?
>
> Here is my code in java:
>
>
>
> ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(this.getHostNameConnectionString());
>
>             // Create a Connection
>             Connection connection = connectionFactory.createConnection();
>             connection.start();
>
>             // Create a Session
>             Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>
>             // Create the destination (Topic or Queue)
>             Destination destination =
> session.createQueue(this.getQueName());
>
>             // Create a MessageConsumer from the Session to the Topic or
> Queue
>             MessageConsumer consumer = session.createConsumer(destination);
>
>
>             // Wait for a message 1 second, timeunut is in miliseconds
>             Message message = consumer.receive(1000);
>
>             if (message instanceof TextMessage) {
>
>                 File filetoWrite = new File(fileName);
>
>                 if(filetoWrite.exists()){
>                    filetoWrite.delete();
>                 }
>
>                 TextMessage textMessage = (TextMessage) message;
>
>
>                 FileWriter fw = new 
> FileWriter(filetoWrite.getAbsoluteFile(),true);
>                 BufferedWriter bw = new BufferedWriter(fw);
>                 bw.write(textMessage.getText());
>                 bw.close();
>
>                 messagePayLoad = "done#";
>
>             } else {
>                 messagePayLoad  = "empty";
>             }
>
>
>
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/Norwegian-character-ActiveMQ-consumer-problem-tp4673926.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.



-- 
Hiram Chirino

Engineering | Red Hat, Inc.

[email protected] | fusesource.com | redhat.com

skype: hiramchirino | twitter: @hiramchirino

blog: Hiram Chirino's Bit Mojo

Reply via email to