 |
|
 |
hy,
ich bräuchte eine dll datei, bei welcher der Proxy auf automatisch erkennen geschalten ist oder ich einen angeben kann.
mfg,
David
|
|
|
|
 |
|
|
 |
|
 |
das habe ich gelesen, jedoch finde ich keine dll welche einfach in die C# Anwendung implementieren kann.
benutze eure dll gerne, habe derzeit eine RavSoft.WebRessourceProvider dll(Namensraum: RavSoft)
habe die DLL leider nicht gefunden.
vielleicht bin ich einfach nur unfähig es zu finden, habe nur die versionen ohne Proxy gefunden.
bzw.: Ich habe leider keine Ahnung wie cih aus euren Projekt wieder eine DLL mache, welche für C# verwendbar ist. kenne mich in C++ leider sehr wenig aus.
mfg,
David
|
|
|
|
 |
|
 |
Ravi, do you think I could achieve English to Japanese translation if I convert WebResourceProvider to Unicode? My understanding is that Web pages are encoded with an 8-bit encoding (usually UTF8), so is Unicode relevant in this case?
I'll be grateful for your opinion.
|
|
|
|
 |
|
 |
Ravi, any chance that you could make this project unicode compatible please?
|
|
|
|
 |
|
 |
I'd like to say "maybe" but I'm severly cycle starved.
/ravi
|
|
|
|
 |
|
 |
I found that the 'Translator' function failed - it gave message: "Unable to translate text."
Suggested fix:
In Translator.cpp, change line 89
from:
if (!skipTo ("<div id=result_box dir=ltr>"))
to:
if (!skipTo ("<div id=result_box dir=\"ltr\">"))
(the latter string is used in Google Translator project).
|
|
|
|
 |
|
 |
Thanks. I'll backport the fix from the .NET version.
/ravi
|
|
|
|
 |
|
 |
Hi
Thanks for providing this code. I want to use the demo code for accessing Google Translator.
I'm sitting behind a proxy server. Your GoogleTranslator project works fine (I don't know how it knows about the proxy). However, the WebResourceProvider Demo Translate function just times out.
I prefer to use the WebResourceProvider Demo as a basis for my project because I know C++ not C#. I can see that CWebGrab has a proxy setting but I think that CWebGrab is not used by Translate. Please can you suggest how I can modify WebResourceProvider Demo so that it knows about the proxy for the case of Translate?
David
|
|
|
|
 |
|
 |
You hit the nail on the head! The C++ version is proxy disadvantaged - unfortunately I haven't had the cycles to make it mimic the .NET flavor.
My GoogleTranslator article uses the .NET version which works thru a proxy server. As a worst case scenario, your C++ app could slave a .NET app to do the translation, although I agree it's prolly less work to make the C++ version proxy happy.
/ravi
|
|
|
|
 |
|
 |
Thanks for your reply.
> As a worst case scenario, your C++ app could slave a .NET app to do the translation
Briefly, how would I do that?
Or I guess I could replace GoogleTranslator.cs with a C++ version. But how would I reference the DLL?
Sorry, I only know C++ and MFC, not C# and .NET.
I would appreciate any guidance you can give as I am very keen to use this code.
David
|
|
|
|
 |
|
 |
Ravi, please will you give me a hint as to how to modify this C++ version to use a proxy? Does it use an underlying MFC class that I can instruct to use a proxy server?
|
|
|
|
 |
|
 |
I enabled proxy server compatibility by changing line 69 of AmHttpSocket.cpp from:
hIO = InternetOpen(m_strAgentName, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
to
hIO = InternetOpen(m_strAgentName, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
works for me under Win XP SP2.
See: http://msdn.microsoft.com/en-us/library/aa383996(VS.85).aspx
|
|
|
|
 |
|
 |
Thanks, David! I'll update the article.
/ravi
|
|
|
|
 |
|
 |
Does the CWebResourceProvider class work in Unicode builds?
|
|
|
|
 |
|
 |
Hi Hans,
It will need to be modified (_T(), etc) to support Unicode. There's no reason why this can't be done, but it doesn't support Unicode currently. The .NET version (see my other articles) obviously supports Unicode out of the box.
Thanks,
/ravi
|
|
|
|
 |
|
 |
OK, thanks for the quick reply. Do you have a later version that has support for proxies? I don't see that on the history list.
|
|
|
|
 |
|
 |
Hans Dietrich wrote: support for proxies?
That's still on my to-do list...
/ravi
|
|
|
|
 |
|
 |
Ravi, thank you for the useful code.
However, it would be really nice if you could have a C++ Unicode version. Otherwise you cant translate to Chinese for example. Now you might think doing so is simple, a few defines, but no.... I see that your code relies on InternetReadFile, as does some of my mine, but there is no InternetReadFileW! There is a InternetReadFileExW but it works differently and I have yet to track down a working example (which is how I stumbled on this article).
If a web page returns Unicode, then InternetReadFile will convert it for you, which does not work that well for some languages.
If you could make a Unicode version, you would a hero!
|
|
|
|
 |
|
 |
Thanks for your comments!
Unfortunately I'm severely cycle disadvantaged right now Btw, there's a .NET version of this class @ CP if you'd like to use it. Free Unicode, etc.
/ravi
|
|
|
|
 |
|
 |
On a similar project I was working on, I had to get Unicode translation to work in C++, and I was using Google translator.
I finally figured out that with Unicode you still use InternetReadFile BUT you typically have to use MultiByteToWideChar(CP_UTF8,... ) to convert the content to Unicode wchar_t. Assuming it is UTF-8 this works fine and you get nice chinese characters which you should be getting. If the returned text really is just plain ascii, then MultiByteToWideChar does no harm (MSDN confirms this).
I guess the general approach to use is to use the API function which tells you if the returned buffer is Unicode or not, and if not, convert it to Unicode using MultiByteToWideChar. In theory you may be able to get hold of the headers which may tell you, but I had little luck doing that.
Sadly the above is the result of several hours of struggling and colourful language.
|
|
|
|
 |
|
 |
I assume you're forced to code this in C++?
/ravi
|
|
|
|
 |
|
 |
For instance, I choose the translater everytime I run it, pops up " Unable to translate text." Looking forward to your respond
Thank you in advance.
Cheers,
Ryan
|
|
|
|
 |
|
 |
I wanna clarify, the zipcode button works properly.
The other three buttons dont function.
Thank you.
Cheers
|
|
|
|
 |
|
 |
Thanks, I'll look it into it.
/ravi
|
|
|
|
 |