Convert LPWSTR to v8::String

LPWSTR dscStr = "TEST STRING AAAAAA";

char buffer[5000];
wcstombs(buffer, dscStr, sizeof(dscStr));

return scope.Close(String::New(buffer)); // FAILED

I need to convert LPWSTR(or LPCWSTR) to v8::String.

The code you've posted shouldn't even compile, since you're trying to assign a char const * to a wchar_t *.

This should work (I don't know anything about v8::String so I'm assuming the constructor call in the last line is correct)

LPCWSTR dscStr = L"TEST STRING AAAAAA";
// LPCWSTR is an alias for wchar_t const *
// The L before the string literal indicates it is a wide string literal

char buffer[5000];
wcstombs( buffer, dscStr, wcslen(dscStr) );
// Need wcslen to compute the length of the string

return scope.Close(String::New(buffer));