IRC Log Viewer » #firebreath » 2015-11-02

IRC Nick Time (GMT-7) Message
Enkindler 06:11 Hello again... Does cout work for printing to the console while debugging?
Enkindler 09:11 does getParam work with special characters?
taxilian 10:11 theoretically it should work with anything that is a valid html param name
and it'll be UTF8
that hasn't been extensively tested, there could be some bugs
Enkindler: no, don't ever use cout =] cerr should be usable, but it'd be better to use a log file and set up log4cplus
Enkindler 11:11 taxilian, I tried with cout and it didn't work. Didn't know about cerr... I was testing some param stuff that was bugged...
I'm currently having issues with the getParam because it won't correctly recieve accentd words
I have solved it by modifying the method declaration and definition so it returns a wstring, but I'm not entirely sure that is the right way, so I don't really like it
Is there a better way?
I don't recieve the accented letters in special characters (UTF) but the letter it self (á, é, í, ó, and ú)
taxilian 11:11 it's going to depend on how it's sent through the string
making it a wstring shouldn't make any difference; in fact, if you need that you can just use FB::utf8_to_wstring to convert it after you get it back
but is this on Chrome?
Enkindler 11:11 yes, chrome
I send the param with the following line
parametrosImpresion["param9"] = "Venezolano de Crédito";
notice the é in "Crédito"? at the end?
the thing is, it seems as if the getParam method it self is not properly parsing the accented letter...
I tried converting the std::string to wstring, with wstring.assing(string.begin(), string.end)
but since the original string has the bad parsed character it kinda serves no purpose...
taxilian 12:11 right; so you're trying to fix the issue in the wrong place, is the thing
you need to figure out where it's getting processed incorrectly
either the browser isn't sending it correctly or we aren't reading it correctly
either way it's probably inside FireWyrmNativeMessageHost
well, if it's fixable that's likely where it is
Enkindler 12:11 I belive It's inside the getParam itself, or right before it. making the change (to wstring) fixed the issue with this particular case...
taxilian 12:11 possibly jsoncpp isn't handling it correctly
it's possible, but very unlikely
unless you're reading it wrong =]
wait a sec...
you can't just convert std:;string to wstring with assign
it's not a direct copy, it's a conversion
the std::string should be utf8
use FB::utf8_to_wstring
you're probably just trying to read the utf8 string like it's a normal string
if you need it to be a wstring, convert it back in your code with FB::utf8_to_wstring
Enkindler 12:11 I was thinking wstring because it seemed to be the only solution... However, is there a way to make string work with the accented letters? UTF-8?
I was thinking wstring because it seemed to be the only solution... However, is there a way to make string work with the accented letters? UTF-8?
taxilian 12:11 sounds like you should do some reading up on UTF8
but what are you actually trying to accomplish with this string?
because that's going to determine what format you want
Enkindler 12:11 That's likely...
I recieve the string as a param... and that same string should be sent to the printer
Basically the string comes from a DB, and the plugin takes care of the printing part...
taxilian 12:11 what format does the printer expect it to be in?
if you give it to the printer as a wstring does it work?
Enkindler 12:11 yes, it works
taxilian 12:11 then use a wstring, but don't change firebreath code to do it
change it in your own code with FB::utf8_to_wstring which accepts a std::string and returns a std::wstring
Enkindler 12:11 Let me test it an see if it works...
taxilian 12:11 unless your printer library supports utf8 that's what you'll need to do
unless your printer library supports utf8 that's what you'll need to do
if that doesn't work then nothing will =] it comes in utf8 from the browser, so if you've got it in a wstring you've already converted it with that function somewhere
Enkindler 12:11 The thing is, while debugging, I retrieve the param to an string var... and checkin the value in the debugger shows me the badly formated characters
taxilian 12:11 yes, that's normal
because the debugger doesn't understand utf8
because the debugger doesn't understand utf8
Enkindler 12:11 So, the badly translated character should fix themselves with the FB::utf8_to_wstring?
taxilian 12:11 more to the point, the character is just fine, it's just not in the format that the debugger understands
if you change it to a wstring it should understand it, assuming you do so using utf8_to_wstring and don't try to just assign it =]
Enkindler 12:11 Alright then... let me see how it works and I'll get back to you...
Enkindler 12:11 Btw... How's the little girl doing?