diff --git a/atom/common/api/atom_api_clipboard.cc b/atom/common/api/atom_api_clipboard.cc index e98c2f29a74..0789f51c060 100644 --- a/atom/common/api/atom_api_clipboard.cc +++ b/atom/common/api/atom_api_clipboard.cc @@ -5,6 +5,7 @@ #include #include +#include "atom/common/native_mate_converters/string16_converter.h" #include "native_mate/dictionary.h" #include "ui/base/clipboard/clipboard.h" @@ -27,11 +28,11 @@ std::string Read(const std::string& format_string) { return data; } -std::string ReadText() { +string16 ReadText() { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); - std::string data; - clipboard->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &data); + string16 data; + clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &data); return data; } diff --git a/spec/api-clipboard-spec.coffee b/spec/api-clipboard-spec.coffee new file mode 100644 index 00000000000..eecf61ca454 --- /dev/null +++ b/spec/api-clipboard-spec.coffee @@ -0,0 +1,9 @@ +assert = require 'assert' +clipboard = require 'clipboard' + +describe 'clipboard module', -> + describe 'clipboard.readText()', -> + it 'returns unicode string correctly', -> + text = '千江有水千江月,万里无云万里天' + clipboard.writeText text + assert.equal clipboard.readText(), text