_POST []删除所有+号

I have a simple java code that send a POST request to a php file, for example i send "test+-" when i echo the post it return "test -" why the + is removed?

The java code convert the text to bytes, maybe there is the sign lost?

OutputStream out=conn.getOutputStream();
        out.write(test.getBytes());

Thx for the help.

Update:

I tyed out.write(URLEncoder.encode(test).getBytes());, thx to @Marek but with this method the php don't recognizes the POST text

Edit:

Found solution, based on @HugoDelsing answer i just replace in the php class all spaces with a + and solve the error.

$test = str_replace(' ', '+', $test);

You can't just write post stream, you have to encode it, for example using URLEncoder:

out.write(URLEncoder.encode(test).getBytes());

It's not clear what encoding you are using, supply it as second parameter.