Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart quotes shouldn't break the pyxform #85

Closed
yanokwa opened this issue Sep 22, 2016 · 11 comments
Closed

Smart quotes shouldn't break the pyxform #85

yanokwa opened this issue Sep 22, 2016 · 11 comments

Comments

@yanokwa
Copy link
Contributor

yanokwa commented Sep 22, 2016

Works: selected(${branch}, 'o')

Doesn't work: selected(${branch}, ‘o’)

test.xlsx

It'd be good if smart quotes were allowed in labels, but I don't know how this plays with UTF-8 and the XML spec and JavaRosa.

@dorey
Copy link
Contributor

dorey commented Sep 22, 2016

Any objections to replacing all of these smart characters with their simpler equivalents?

@yanokwa
Copy link
Contributor Author

yanokwa commented Sep 22, 2016

I personally don't mind, but a lot of design people really like smart quotes.

@MartijnR
Copy link
Contributor

Smart quotes are not supported in XPath 1.0 as far as I know, so replacing might be the only way.

See in browser javascript console:

document.evaluate('string("o")', document.documentElement, document.createNSResolver(document.documentElement), XPathResult.STRING_TYPE, null).stringValue

versus:

document.evaluate('string(‘o’)', document.documentElement, document.createNSResolver(document.documentElement), XPathResult.STRING_TYPE, null).stringValue

screen shot 2016-09-22 at 10 08 55 am

@yanokwa
Copy link
Contributor Author

yanokwa commented Sep 22, 2016

Pretty compelling evidence :)

Sounds like replacing is the right way to go.

@dorey
Copy link
Contributor

dorey commented May 31, 2017

I'll write a test of this change.
Then fixing it shouldn't be hard, just a matter of finding the best place to do it

@dorey
Copy link
Contributor

dorey commented May 31, 2017

Should smart quotes in labels be simplified as well? Or just constraints and relevants?

I'll aim to replace all smart quotes throughout the document.

@dorey
Copy link
Contributor

dorey commented Jun 1, 2017

All fancy quote characters in any field in the survey sheet will be replaced.

This change does not touch the settings or choices sheets. (Should it?)

@yanokwa
Copy link
Contributor Author

yanokwa commented Jun 1, 2017

I think you should replace smart quotes everywhere.

Settings has form_title and version and what you enter there will show up in the XML. Ditto with the names and labels in the choices.

@ukanga ukanga closed this as completed in 2740e58 Jun 2, 2017
ukanga added a commit that referenced this issue Jun 2, 2017
Replace smart quotes in form, closes #85
@yixi8524
Copy link

@yanokwa Why do we need to replace all the smart quotes everywhere? Should we consider about this replace function will change the user's real content in the Form? Like label and hint?

@fendiaoxiaoshuazi
Copy link

fendiaoxiaoshuazi commented Feb 20, 2023

The smart quotes are used in Chinese, I guess other languages also use smart quotes often. Therefore, this conversion may affect the survey content of some multiple-language surveys.

@lognaturel
Copy link
Contributor

@yixi8524 @fendiaoxiaoshuazi if you are interested in exploring a way to maintain smart quotes within strings and hints, please consider opening a PR! Please verify output with the latest releases of both ODK Collect and Enketo Express.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants