Yes it is true that decodeURIComponent function doesn’t convert + to space. So you have to replace the + using replace function.
Ideally the below solution works.
var str_name="This+is+a+message+with+spaces";
decodeURIComponent((str_name + '').replace(/\+/g, '%20'));