Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

在系统语言为繁体中文情况下,读取中文不正常

Aperta
#916 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
data

Direzione di ricerca

The report reduces to the calls XMLElement::SetText, XMLDocument::SaveFile, XMLDocument::LoadFile and XMLElement::GetText, with the user's Chinese string written to a file and read back under a Traditional Chinese Windows locale. Start by reproducing the round trip with a small program that writes and reads the same string, then check what encoding the saved declaration and text actually use. Done means the string survives the round trip under that locale, or the issue is closed with a documented encoding requirement. The thread has no maintainer reply and the reporter's code is incomplete, so the expected behaviour needs confirming first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

1.在系统语言为繁体中文情况下异常,但在系统语言为简体中文情况正常
2.我的vs项目使用的UNIcode字符集
3.下面是我写的代码,但无论如何转字符编码(我有尝试过gb2312 utf8 ansi),变量str都无法正确解析字符串,均为乱码
tinyxml2::XMLDocument doc;

XMLDeclaration* declaration = doc.NewDeclaration();

string text = "白白魂";
//ANSItoUTF8(text);

XMLElement* pRoot = doc.NewElement("Root");

pRoot->SetText(text.c_str());
doc.InsertFirstChild(declaration);
doc.InsertEndChild(pRoot);
doc.SaveFile("C:\\Users\\Method-PC\\Desktop\\1.xml");


tinyxml2::XMLDocument loaddoc;
loaddoc.LoadFile("C:\\Users\\Method-PC\\Desktop\\1.xml");
XMLElement *ele =  loaddoc.RootElement();
string str  = ele->GetText();
//UTF8toANSI(str);
int a = 0

企业微信截图_20220810160112
;

Lingua principale
C++
Stelle
5.8k
Fork
2k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di leethomason/tinyxml2

Tutte le issue di leethomason/tinyxml2

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.