Vedis Users Forum

vedis with unicode characters

append delete jweaver

Hi everyone,

I'm experiencing a strange unicode "issue", where values in a set (and other key's values - not limited to sets) will display unicode characters randomly. Sometimes a black diamond with a question mark, others a fancy 'u' character. Is there a param in vedis I need to set to avoid storing in unicode?

Thanks a lot!

Reply RSS


append delete #1. chm

Those are trailing garbage when working with strings. You should rely on the pLen parameter when casting values using vedis_value_to_string()[1].


append delete #2. jweaver

chm you're a savior! I know you're quite busy over there and I appreciate the response! I'll give it a shot and see what the outcome is. Another question I was going to ask, was is it better to use several databases or one large one? What prompted this question is I've noticed when querying the database for several values at the same time, it at times only displays 3 of 7 values for example. Running the function that queries for those same values again, might yield all 7, and then the next run 4 of 7. This is the type of response pattern I'm noticing and I was curious if it was perhaps related to threading and the queries happening too quickly. Thank you very much again!

append delete #3. chm

can you provide any chunk of code for that? You could email if you do not want to share your code here in the public.

append delete #4. jweaver

Sent over an e-mail to you regarding the second question. Here's the code for the first:

vedis_value *eventRet;
const char *eventInfo;
int pLen;
ostringstream eret;
eret << "lm" << eventD;

vedis_exec_fmt(godb,"SMEMBERS %s",eret.str().c_str());

eventInfo = vedis_value_to_string(eventRet,&pLen);
eventInfo[pLen] = '\0';

Should that take care of the garbage? Thanks again chm!

append delete #5. jweaver

I've revised this a bit:

void getMatches (int64_t matchID) {
vedis_value *dataRet;
const char *dataInfo;
int pLen;
ostringstream eret;
eret << "lm" << matchID;

vedis_exec_fmt(godb,"SMEMBERS %s",eret.str().c_str());

dataInfo = vedis_value_to_string(dataRet,&pLen);
char *newInfo = strdup(dataInfo);
newInfo[pLen] = '\0';

Yet the result is the same. Where am I taking a wrong turn here?

append delete #6. jweaver

I've been at this for the day now, and the last attempt was to use the array handling built in. Here's an example of the output:


(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.