FAQ
When I deployed my Struts2+Spring3+Hibernate3+Tomcat6.0+MySQL5.1
project (which is running well on my local PC ) onto the CloudFoundry
as a standalone app,

And I found there's a serious problem:
All my Chinese characters in my code can not be printed out
properly.

For example, if I write "System.out.println("Chinese:"+"汉字")" in my
code, what I get in stdout.log is "Chinese:??"

It is the same whenever my String parameters were passed with values
of Chinese characters, the method will get "????" instead.

My project is UTF-8, and my Tomcat encoding is UTF-8 too.

Using .getBytres() may solve problem, but it is obviously not a good
idea as I should not have to do this locally. So, I think maybe
something is wrong in the environment of CF, which is supposed to
support every encoding method.

This is weird.

Search Discussions

  • Pieter Noordhuis at Jun 7, 2012 at 4:30 pm
    I assume you retrieve the characters via "vmc logs"?

    I tested writing UTF-8 encoded characters to stdout with a simple Ruby
    app, and it appears to work as intended. I see the same UTF-8
    characters in the output for "vmc logs" as I write from the source
    code.

    Does it work correctly when you run the application locally?

    Cheers,
    Pieter
    On Thu, Jun 7, 2012 at 12:36 AM, 张 磊 wrote:
    When I deployed my Struts2+Spring3+Hibernate3+Tomcat6.0+MySQL5.1
    project (which is running well on my local PC ) onto the CloudFoundry
    as a standalone app,

    And I found there's a serious problem:
    All my Chinese characters in my code can not be printed out
    properly.

    For example, if I write "System.out.println("Chinese:"+"汉字")" in my
    code, what I get in stdout.log is "Chinese:??"

    It is the same whenever my String parameters were passed with values
    of Chinese characters, the method will get "????" instead.

    My project is UTF-8, and my Tomcat encoding is UTF-8 too.

    Using .getBytres() may solve problem, but it is obviously not a good
    idea as I should not have to do this locally. So, I think maybe
    something is wrong in the environment of CF, which is supposed to
    support every encoding method.

    This is weird.
  • 张 磊 at Jun 8, 2012 at 3:29 am
    My app has had a good running on my local Tomcat6.0 for months. And I
    found there' no character problem when pushed it onto
    xxxx.cloudfoundry.com.

    But whenever I move it onto my xxxx.vcap.me, there came out "????"
    problem, is there something wrong of my CF or DEAs?

    And if I write a ruby program and puts "汉字", it works well too.So
    maybe there's something wrong with my springframework in CF?.
    On Jun 8, 12:29 am, Pieter Noordhuis wrote:
    I assume you retrieve the characters via "vmc logs"?

    I tested writing UTF-8 encoded characters to stdout with a simple Ruby
    app, and it appears to work as intended. I see the same UTF-8
    characters in the output for "vmc logs" as I write from the source
    code.

    Does it work correctly when you run the application locally?

    Cheers,
    Pieter






    On Thu, Jun 7, 2012 at 12:36 AM, 张 磊 wrote:
    When I deployed my Struts2+Spring3+Hibernate3+Tomcat6.0+MySQL5.1
    project (which is running well on my local PC ) onto the CloudFoundry
    as a standalone app,
    And I found there's a serious problem:
    All my Chinese characters in my code can not be printed out
    properly.
    For example, if I write "System.out.println("Chinese:"+"汉字")" in my
    code, what I get in stdout.log is "Chinese:??"
    It is the same whenever my String parameters were passed with values
    of Chinese characters, the method will get "????" instead.
    My project is UTF-8, and my Tomcat encoding is UTF-8 too.
    Using .getBytres() may solve problem, but it is obviously not a good
    idea as I should not have to do this locally. So, I think maybe
    something is wrong in the environment of CF, which is supposed to
    support every encoding method.
    This is weird.
  • Thomas Risberg at Jun 8, 2012 at 4:27 am
    Hi,

    The default character set when I run a Java app on cloudfoundry.com is
    'UTF-8' while it seems to be 'US-ASCII' when I run the same app on a local
    vcap.me install.

    Here is the output from my standalone Java app on vcap.me:

    Java Version: 1.6.0_20
    PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Encoding: US-ASCII

    I can log in to the local vcap system and go to the
    /var/vcap.local/dea/app directory and run my app from the command line
    giving this output:

    Java Version: 1.6.0_20
    PATH:
    /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    Encoding: UTF-8

    So it seems to be a difference in the environment when the app is started,
    most likely in the DEA.

    Looks like the same is true for Ruby and since the DEA is a Ruby app that
    could account for the difference with the Java apps. Using Ruby19 on
    cloudfoundry.com a Ruby app printing Encoding.default_external returns
    UTF-8 while it returns US-ASCII on vcap.me.

    We'll have to look into the Ruby config for the DEA on vcap.me in more
    detail.

    -Thomas

    On Thu, Jun 7, 2012 at 11:29 PM, 张 磊 wrote:

    My app has had a good running on my local Tomcat6.0 for months. And I
    found there' no character problem when pushed it onto
    xxxx.cloudfoundry.com.

    But whenever I move it onto my xxxx.vcap.me, there came out "????"
    problem, is there something wrong of my CF or DEAs?

    And if I write a ruby program and puts "汉字", it works well too.So
    maybe there's something wrong with my springframework in CF?.
    On Jun 8, 12:29 am, Pieter Noordhuis wrote:
    I assume you retrieve the characters via "vmc logs"?

    I tested writing UTF-8 encoded characters to stdout with a simple Ruby
    app, and it appears to work as intended. I see the same UTF-8
    characters in the output for "vmc logs" as I write from the source
    code.

    Does it work correctly when you run the application locally?

    Cheers,
    Pieter






    On Thu, Jun 7, 2012 at 12:36 AM, 张 磊 wrote:
    When I deployed my Struts2+Spring3+Hibernate3+Tomcat6.0+MySQL5.1
    project (which is running well on my local PC ) onto the CloudFoundry
    as a standalone app,
    And I found there's a serious problem:
    All my Chinese characters in my code can not be printed out
    properly.
    For example, if I write "System.out.println("Chinese:"+"汉字")" in my
    code, what I get in stdout.log is "Chinese:??"
    It is the same whenever my String parameters were passed with values
    of Chinese characters, the method will get "????" instead.
    My project is UTF-8, and my Tomcat encoding is UTF-8 too.
    Using .getBytres() may solve problem, but it is obviously not a good
    idea as I should not have to do this locally. So, I think maybe
    something is wrong in the environment of CF, which is supposed to
    support every encoding method.
    This is weird.
  • 张 磊 at Jun 8, 2012 at 5:06 am
    Thanks a lot. What can if I want to solve this encoding things locally
    on vcap.me?
    On Jun 8, 12:27 pm, Thomas Risberg wrote:
    Hi,

    The default character set when I run a Java app on cloudfoundry.com is
    'UTF-8' while it seems to be 'US-ASCII' when I run the same app on a local
    vcap.me install.

    Here is the output from my standalone Java app on vcap.me:

    Java Version: 1.6.0_20
    PATH: /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    Encoding: US-ASCII

    I can log in to the local vcap system and go to the
    /var/vcap.local/dea/app directory and run my app from the command line
    giving this output:

    Java Version: 1.6.0_20
    PATH:
    /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    Encoding: UTF-8

    So it seems to be a difference in the environment when the app is started,
    most likely in the DEA.

    Looks like the same is true for Ruby and since the DEA is a Ruby app that
    could account for the difference with the Java apps. Using Ruby19 on
    cloudfoundry.com a Ruby app printing Encoding.default_external returns
    UTF-8 while it returns US-ASCII on vcap.me.

    We'll have to look into the Ruby config for the DEA on vcap.me in more
    detail.

    -Thomas






    On Thu, Jun 7, 2012 at 11:29 PM, 张 磊 wrote:
    My app has had a good running on my local Tomcat6.0 for months. And I
    found there' no character problem when pushed it onto
    xxxx.cloudfoundry.com.
    But whenever I move it onto my xxxx.vcap.me, there came out "????"
    problem, is there something wrong of my CF or DEAs?
    And if I write a ruby program and puts "汉字", it works well too.So
    maybe there's something wrong with my springframework in CF?.
    On Jun 8, 12:29 am, Pieter Noordhuis wrote:
    I assume you retrieve the characters via "vmc logs"?
    I tested writing UTF-8 encoded characters to stdout with a simple Ruby
    app, and it appears to work as intended. I see the same UTF-8
    characters in the output for "vmc logs" as I write from the source
    code.
    Does it work correctly when you run the application locally?
    Cheers,
    Pieter
    On Thu, Jun 7, 2012 at 12:36 AM, 张 磊 wrote:
    When I deployed my Struts2+Spring3+Hibernate3+Tomcat6.0+MySQL5.1
    project (which is running well on my local PC ) onto the CloudFoundry
    as a standalone app,
    And I found there's a serious problem:
    All my Chinese characters in my code can not be printed out
    properly.
    For example, if I write "System.out.println("Chinese:"+"汉字")" in my
    code, what I get in stdout.log is "Chinese:??"
    It is the same whenever my String parameters were passed with values
    of Chinese characters, the method will get "????" instead.
    My project is UTF-8, and my Tomcat encoding is UTF-8 too.
    Using .getBytres() may solve problem, but it is obviously not a good
    idea as I should not have to do this locally. So, I think maybe
    something is wrong in the environment of CF, which is supposed to
    support every encoding method.
    This is weird.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupvcap-dev @
postedJun 7, '12 at 7:36a
activeJun 8, '12 at 5:06a
posts5
users3

People

Translate

site design / logo © 2022 Grokbase