You are not logged in.

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

1

Tuesday, November 8th 2011, 10:20pm

[Solved + 1.0.8.14minor fix] Using single quote within showtext inside a set function

Depending on user imput, I'm changing onhover caption, using a call to set function like this:

Source code

1
set(hotspot[myspot].onhover, showtext('Some text',mystyle));


And then, some moment later, I will call this to change text:

Source code

1
set(hotspot[myspot].onhover, showtext('NEW TEXT',mystyle));


This work well with text formatting (italic, bold, underline, line break) and quote (encoded as "), but I didn't find any way to insert a quote within this text.

Trying theses will fail:

Source code

1
2
3
4
5
set(hotspot[myspot].onhover, showtext('My brother's test',mystyle));
set(hotspot[myspot].onhover, showtext(My brother's test,mystyle));
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));
set(hotspot[myspot].onhover, showtext("My brother%39s test",mystyle));
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));


Any ideas ? *confused*

Thanks!
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

This post has been edited 1 times, last edit by "martinlbb" (Dec 20th 2011, 10:02pm)


Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Friday, November 11th 2011, 11:29am

<action name="something">
set(hotspot[myspot].onhover, showtext("My brother's test",mystyle));
</action>

should work

else use:

& #39; (without the space between & and #)

not %39
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

3

Friday, November 11th 2011, 1:07pm

Thanks for you reply.

Yes, adding double quote should work, but only when modifying one item at a time. Same if you are using HTML encoded chars (&#charvalue;).

If you want to modify severals items in the same functions, then it fail.

I did a test tour, available here: http://www.martinloyer.fr/sharing/krpano/demo.html

You can look here XML : http://www.martinloyer.fr/sharing/krpano/demo.xml

It's fairly simple. V1 button will update only one item (button itself), while V2 button will try to update V1 and V2 captions.
V1 button work well while V2 button just fail.

Any ideas ?
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

4

Monday, December 19th 2011, 1:03pm

Up...!

Problem is still here :(

Klaus, any idea?
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

5

Monday, December 19th 2011, 4:03pm

That happens because you are using single quotes in the content of the action.. which causes it to parse incorrectly. Please escape it as everyone has already said.

Try

Source code

1
2
3
4
5
6
7
	<action name="modify_more_caption">
		showlog(true);
		trace('V2 function launched. Howewever, V1 caption nor V2 caption are updated... :(');
		trace('You should read V2 TEST OK on both buttons....');
		set(hotspot[button].onhover, showtext("V2 TEST OK: My brother&amp;#39;s caption",defaultstyle));
		set(hotspot[button].onhover, showtext("V2 TEST OK: My caption&amp;#39;s brother",defaultstyle));
	</action>
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

6

Monday, December 19th 2011, 4:24pm

Many thanks sachagriffin, your answer solved it.

However, the single post from Zephyr suggested to use ampersand with decimal value as used in HTML, but it don't work.
Example below:

Source code

1
&39;


Or to use % with decimal value (coming from Krpano documentation, located here : http://krpano.com/docu/actions/#showtext )
Example below:

Source code

1
% 39  (without space)


You are using a different way, using an HTML written ampersand (&amp;) with an hash and decimal value.
Example below :

Source code

1
&amp;#39;


From now, I never saw it in KrPano documentation, or even on showtext function :(
It may help other developer to had this useful information on KrPano. That was the primary idea of this post.

PS: Zephir, you are lucky, now you are everyone *g*
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

7

Monday, December 19th 2011, 4:46pm

Showtext is kinda strange in this way.
This issue actually comes up fairly frequently.
Here's a link to the last post in August.
showtext single-quote or apostrophe issues
Usually you can save a ton of time debugging by searching for the issue in various keyword combinations.
Nice clean example though.
Some people post thousand line chunks of code when all they needed was one or two and/or links to tours that contain about a zillion nested includes.. No one but a saint has time to troubleshoot this type of stuff.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

8

Monday, December 19th 2011, 5:14pm

Showtext is kinda strange in this way. http://www.1001photographes.com/annuaire…665&PREVIEW=OUI
Sure :/


This issue actually comes up fairly frequently.
Here's a link to the last post in August.
showtext single-quote or apostrophe issues

Sorry to hear about that. But I did forum search before, Krpano doc and even Hoogle crawling before. Unlucky :(



Usually you can save a ton of time debugging by searching for the issue in various keyword combinations.

I did :) For me, using ampersand coded in HTML was to weird to be accepted by XML parser. I was wrong...

No one but a saint has time to troubleshoot this type of stuff.

Sure, I also helps on other forum, and it's always the same 'way of life'.

Thanks for your help. I hope documentation will be updated, to avoid such posting ;)
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

9

Monday, December 19th 2011, 5:25pm

I've also ranted enough about these issues. There are some that are MUCH harder to figure out than showtext, like needing to use %%27 to escape a split double quote. I think Klaus finally agrees that there is a lot of problems in this area, and he is thinking about adding some supported
escape() unescape() functions for the next version and yes there isn't really any documentation for these special characters and when they need to be used except for forum posts.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

10

Tuesday, December 20th 2011, 11:59am

Hi,

just a quick note - this issue will be fixed in the next release,

best regards,
Klaus

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

11

Tuesday, December 20th 2011, 9:28pm

Thanks Klaus!

@sachagriffin: thanks for your %%27 tips ;)
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

12

Tuesday, December 20th 2011, 9:58pm

Hi,

here the fixed release:
krpano 1.0.8.14

best regards,
Klaus

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

13

Tuesday, December 20th 2011, 10:01pm

Quick fix!

Thanks Klauss!

I test it and let forum now.
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

14

Wednesday, December 21st 2011, 1:46am

So does that mean we can now use raw single quotes in a double quote?
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

martinlbb

Beginner

  • "martinlbb" started this thread

Posts: 11

Location: France

Occupation: Pro photographer

  • Send private message

15

Wednesday, December 21st 2011, 10:43am

So does that mean we can now use raw single quotes in a double quote?


Yes :)

I tested it this morning, with minor bug-fixe version.

Available at the same test address: http://www.martinloyer.fr/sharing/krpano/demo.html

Thanks Klaus!
Reveal hidden or unreachable beauty: http://www.martinloyer.fr/en/