I want to convert html files to epub with ebook-convert. I provide book metadata through parameters, but non-ascii characters display ?? in the book meta. I use system:
res = system cmd_line
where cmd_line is a string to be executed
When I execute the same command from command line, it works perfectly.
I use Ruby 1.8.7 and Rails 3.0.13
I'm late to the party here but came looking for a solution to a closely related problem yesterday and so have just upvoted the question.
A possible explanation can be found at the not-obviously-applicable:
Executing ebook-convert from rails non-ascii characters display ?? in meta
where I've added my own take on a potential work-around.
Related
When a user inputs certain special characters i.e a html tag, the user receives this:
Error loading Partial View script (file: ~/Views/MacroPartials/ezSearch.cshtml)
I have been investigating and this seems to be a common issue and I attempted to apply a fix so it would strip out 'bad' characters:
public string CleanseSearchTerm(string input)
{
System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex("[^a-zA-Z0-9 -]");
input = rgx.Replace(input, "");
return input.ToString();
}
However, the issue is that this error is getting generated before it has a chance to hit my method to strip out 'bad' characters. Any ideas of how this can be resolved?
I haven't tried these changes myself Kyle but I have done some investigation to help you fix this problem. Could one of the following solutions help you?
See this Umbraco form question and its answers, especially the one from Ismail Mayat could help you.
Linked to Ismail's answer, there is also this "How to make the Lucene QueryParser more forgiving?" question and I'd recommend you to check the answers for this question, too.
Another answer that might help you is this stackoverflow answer.
Lucene.NET does contain a few classes to help with HTML stripping. These classes are located here in the Lucene.NET repo. Specifically, the HTMLStripCharFilter may be of interest.
I have been using Microsoft Translator API v3.0 which does not seem to work in my case.
The Translation actually appends spaces and the markdown gets scrambled. How to fix this?
Thanks,
deeepss
The ! indicates a sentence end, which is not what you want in this case.
You can escape the exclamation point to a tag like <exclamation>. Then it will be handled as a word in the context of the sentence.
I just stumbled upon an interesting bug... Still trying to figure out what is exactly happening. Maybe you can help.
First, the context. I'm currently building yet another man to html converter (for some reasons I won't motivate here, but I need it).
So, have a look at the screenshot below (see the link), more precisely at the outlined spots. See? On the upper shell, I have < ; and > ;, that is, escaped html.
While on the shell below I have < and > directly.
But as you can see (or do I seriously need looking glass ?), the command man 2 semget | webmanneris the same on both sides, as is the which webmanner. The two are executed roughly at the same moment, with no modification made to the script between.
[Oops, cannot post pictures just yet... Here comes the link]
http://aspyct.org/media/webmanner-bug.png
But the shell below is older (open about 1 hour ago). Newer shells all print out < ;. So my first guess was that it somehow had a cached reference to the old inode of the file, or old blocks or whatever.
So I modified parts of the script, at the start and then at the end, to print different messages. And, surprise, the message shown up on both terminals. But still, same difference between < ; and <.
I'm confused... How to explain that behavior? I'm working on a OSX 10.8 (Mountain Lion)
EDIT: OK, there is one big difference: the shell below uses ruby 1.9.3, while above is 1.8.7. Is there any known difference in string handling between the two versions ?
Are you using the htmlentities library? If so then this bug fix is probably what you are seeing
Ruby 1.9.3 has slightly different behaviour to 1.9.2: the result of
encode was not ASCII even when it only contained ASCII characters.
This may not be important, but this change makes both versions produce
the same result.
https://github.com/threedaymonk/htmlentities/commit/46dafc959de03a02d0c1705bef7f1b157b350025
When I use form helper with GET action, the resulting url shows utf8=✓.
It was caused by rails adding a hidden input utf8. My question is is it possible to remove this?
Why do you want to remove that field? According to this Rails Guides article it's quite useful and helps to overcome issues with some browsers (IE, I believe).
The first input element with name utf8 enforces browsers to properly
respect your form’s character encoding and is generated for all forms
whether their actions are “GET” or “POST”.
See this answer for a nice explanation about why you might need that parameter (previously snowman character was used instead of check mark).
I was wondering, it would be great to know how to allow users to format their posts in Ruby on Rails 3. Ideally, i was wondering if there are any gems or solutions to implementing a formatting system similar to stackoverflow, where the user can bold and underline text, and so on (ie provides a little partial above the post input field similar to the one above the input field we use to ask questions).
Any ideas?
Thanks everyone!
If anyone is still interested in this question, there are a bunch of options for formatting comments and for text editor helpers.
To be brief, I've checked out a whole bunch of options - but I found one that I think is awesome: ckeditor. Check it out at https://github.com/galetahub/ckeditor