Question: I have to write a new web application and currently am in the process of deciding on the architecture , there are several things i know i want to be able to do :

1. All machine must be symmetric , i.e. : commodity machines no custom build servers (aws)
2. I want a ReST API that is seperated from the UI as i allready have three clients for the API : mobile applications , the web site and a server from a 3rd company waiting for the product to be build
3. it needs to able to scale horizontal (a but of a repeat of 1)
4. Easy to maintain : no time to learn new languages , more available candidates but willing to adopt new technologies

here is the basic architecture i've come up with : 

frontend combining of nginx+nodejs+expressjs+YUI , 
api : nginx+tomcat+spring framework stack (rest+Security+core+aop) 

the frontend will talk to the api with oAuth 2.0 

nothing exciting about the api i've done it before , i know it works and works well would have loved to put some scala flavour but i don't have the time .

my main concern is the frontend : nodejs is insanely exciting and i've been playing around for some time also love the fact it's in JS , but i'm afraid about navigation+templating+sessions (for authentication only : stateless,stateless,stateless)+logging+debugging of it , if it works it works well but it's not a mature enviourment to develop in ..... 

anyone here developed a full frontend with stack or subsets of it ? any other suggestions to choose from ? 

thanks guys .

Answer: 
I've had this work for me when I was getting odd characters in place of punctuation:

```
public String getContents(InputStream stream) {
    String contents = null;
    try{
        contents = new String(IOUtilities.streamToBytes(stream), "UTF-8");
    }
    catch(Exception e) {
        //encoding error
    }
    return contents;
}

```
Instead of this:

```
raw.append(new String(data, 0, len));

```

you can use

```
raw.append(new String(data, 0, len, "UTF-8"));

```

passing in the name of a character enconding, in this case UTF-8.