Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
>> >> VM not support chinese print, but arduino 1.8 is ok!
https://www.visualmicro.com/forums/YaBB.pl?num=1546669305

Message started by Teeyacool on Jan 5th, 2019 at 6:21am

Title: VM not support chinese print, but arduino 1.8 is ok!
Post by Teeyacool on Jan 5th, 2019 at 6:21am
Same code runs different result: VM can't show chinese, arduino work well.
Here is part of the code.

Code (c++):
#include <dummy.h>
#include <U8x8lib.h>
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

void setup(void) {
     Serial.begin(115200);
     u8g2.begin();
     u8g2.enableUTF8Print();    // enable UTF8 support for the Arduino print() function
     u8g2.setFont(u8g2_font_wqy16_t_gb2312);  // use chinese2 for all the glyphs of "你好世界"
     u8g2.setFontDirection(0);
     u8g2.setCursor(0, 15);
     u8g2.print("世界你好");    // Chinese "Hello World"
     u8g2.sendBuffer();
}

Title: Re: VM not support chinese print, but arduino 1.8 is ok!
Post by Visual Micro on Jan 5th, 2019 at 5:35pm
This is because your code file has the wrong encoding for your purpose.

Click "File>Save As" then you will see the SAVE button has a "down arrow" menu that shows "Save with encoding". You can click a unicode option near the top of the list.


Title: Re: VM not support chinese print, but arduino 1.8 is ok!
Post by Teeyacool on Jan 7th, 2019 at 1:29am
Thanks a lot!
    According your suggestion, I choose "save whit encoding", and set Unicode, it's show chinese now. :)

Title: Re: VM not support chinese print, but arduino 1.8 is ok!
Post by Visual Micro on Jan 7th, 2019 at 1:13pm
Great, I will look at making new files unicode by default for future release

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2019. All Rights Reserved.