mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
fix Windows text encoding issue causing infinite loop
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
PROJECT(infer_demo C CXX)
|
PROJECT(infer_demo C CXX)
|
||||||
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
|
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
|
||||||
|
if(MSVC)
|
||||||
|
add_definitions(/utf-8)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
|
option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
#include "fastdeploy/text.h"
|
#include "fastdeploy/text.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace paddlenlp;
|
using namespace paddlenlp;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -77,6 +81,9 @@ int main(int argc, char* argv[]) {
|
|||||||
predictor.Predict({"2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷"
|
predictor.Predict({"2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷"
|
||||||
"爱凌以188.25分获得金牌!"},
|
"爱凌以188.25分获得金牌!"},
|
||||||
&results);
|
&results);
|
||||||
|
#ifdef WIN32
|
||||||
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
#endif
|
||||||
std::cout << results << std::endl;
|
std::cout << results << std::endl;
|
||||||
results.clear();
|
results.clear();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user