ActiveQT problem with the transfer Russian characters!!!
-
@
#include <QCoreApplication>
#include <oleauto.h>
#include <ActiveQt/QAxObject>
#include <QAxBase>
#include <QDebug>
#include <QTextCodec>
#include <QString>
#include <QByteArray>
#include <iostream>int main(int argc, char *argv[])
{
::OleInitialize(0);
setlocale(LC_ALL, "Russian");QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Windows-1251"));
qDebug() << QString::fromWCharArray(L"ПользователиИнформационнойБазы").toAscii();QAxObject * ax = new QAxObject("V82.COMConnector"); QAxObject * ac = ax->querySubObject("Connect(\"Srvr=\"172.0.0.100\";Ref=\"base1\";Usr=\"1C-Bot\";Pwd=\"56q\";\")"); QAxObject * ab = ac->querySubObject(QString::fromWCharArray(L"ПользователиИнформационнойБазы").toAscii()); delete ax; qDebug() << "end";
}
@Result
@"ПользователиИнформационнойБазы"
QAxBase::dynamicCallHelper: ??????????????????????????????: No such property in
[unknown]
Candidates are:
end@ -
Using pure Qt 4.8.5
Well you guessed thought about MS VS2010. I will think how to tie the Qt libraries to VS2010.Не знаю на сколько правильно мысль перевел translate.google.ru, на всякий случай по русски напишу :)
Использую чистый Qt 4.8.5
Хорошу вы мысль предположили насчёт MS VS2010. Буду думать, как библиотеки Qt прикрутить к VS2010. -
--
--
Did this one:
@QTextCodec::setCodecForCStrings(QTextCodec::codecForName("Windows-1251"));querySubObject(QString::fromWCharArray(L"ПользователиИнформационнойБазы").toUtf8());@
also not work?
Тоесть я так понимаю ты сейчас в QtCreator'е сидишь? Думаю большой разницы не будет если в MSVC2010 переешь. Просто удобней если ты к студии привык.
Попробуй как я выше написал, если еще не пробовал, может прокатит наконецтаки )Только тут как-бы по русски нельзя - начнут замечания делать :)
-
Ок, будем по инглишу через гугл транслейтер ...
tried and toUtf8 () and toAscii () does not work ...
I think that the problem is not in the coding and in the transformation, and in QAxBase class. For example, if the above view, it is displayed as correct as qDebug, and the interface itself is not true querySubObject takes. I tried to adjust the encoding to std::cout correctly deduced, and then tried to give ActiveX, did not work ... It's a shame that with all the fine words in English and Russian with error ... :(
As a fan of free software just sit under the Qt :) -
I want to help :( ...
-
Russian discussion is here:
http://forum.vingrad.ru/index.php?show_type=forum&showtopic=370551&kw=кодировка-ошибка -
I created the theme. There are solutions to this problem is not found, so I created a thread in the forum Qt.
-
up top my question
-
is up up
-
anybody here?
-
[quote author="_KUL" date="1383200349"]anybody here?[/quote]
Возможно ответ будет уже не актуален, но все же.
QString::toLocal8Bit() пробовали?
Еще (как вариант) можно перебрать различные кодировки (которые потенциально могут использоваться). Некий брутфорс. Я бы сделал это так: создал текстовый файл в одну строку ("ПользователиИнформационнойБазы"), потом считывал бы содержимое в QByteArray и передавал в querySubObject. Изменение кодировки выполняется например с помощью Notepad++.