How can I have spaces in the conf file, they are automaticlly trimmed. How can I force the framework to keep it.
I tried using but it prints out and not the space!
in messages.fr I have
"mykey.range= à "
result in "à" (trimmed)
and
"myKey.range= à "
result in " à " !!!!
I tried "\" before the &. Didn't work... I gave up and asked here.
Use single-quotes around the value to force it to keep your spaces.
conf/messages
mykey.range=' à '
Alternatively, I believe that you could use as you tried but then in your template you would need to tell Play to interpret that text as HTML.
#Html(Messages("mykey.range"))
Related
I ran into a small problem when trying to create a shell line in groovy that is stapled from many variables.
Here is what it looks like:
sh("""
java -jar Report.jar settings.xml "$startTest" "$durationTest" "$opt" empty iReport:gReport:aReport:pReport="$iReport":"$gReport":"$aReport":"$pReport" $reportName
""")
The point is that the command in the shell must run along with the ", which here frames the values of the variables.
However, no matter how much I tried to screen them:
Put \ or \\ in front of "
Convert the string to 'text' + varibale + 'text'
Put the whole shell line in ' and leave " as is, or with the first point taken into account.
None of this works.
Here is an example output:
java -jar Report.jar settings.xml '2022-07-04 11:00' 01:00 'Offset=01:00;' empty iReport:gReport:aReport:pReport=true:true:true:true App.result
You may notice that for some reason two variables are surrounded by quotation marks ' for themselves, although this is not specified anywhere, which is probably the root of the problem.
Because if me use \", the quotes appear, but not everywhere, in general, me get some mishmash of " and '.
To understand, this is how a groovy file works in the Jenkins pipeline.
Hence my question, under what circumstances do variables start framing themselves '' and how to get rid of it?
Or maybe someone has a different solution to this problem, I would appreciate it.
In an Applescript I am trying to pass on a URL that I receive as an argument to a do shell script command to use it with curl.
With regular characters the procedure works fine, but as soon as my argument contains special characters like Umlauts, it gets all funky.
curl does download something, but replaces the letter Ü with à etc., which of course will not get me the correct result.
What do I need to do, to get this to work? I am neither very skilled with Applescript nor with encoding issues.
My setup at the moment is as follows:
set download_URL to item 1 of arguments
do shell script "curl " & download_URL & " > targetFile.html"
Some examples of what happens:
Äquivozität ---> Ãquivozität
Ökolikör ---> Ãkolikör
Übermütigkeit ---> Ãbermütigkeit
Schweißfuß ---> SchweiÃfuÃ
Which makes my confusion even greater. All Ä, Ö, Ü and ß render as Ã, but both in the editing mask here and in the one of the site in question they render as shown in this image.
Also, through some amateurish digging in the html-File, I figured out that instead of the letter Ü, I would need to pass the letters %C3%9C. So the whole procedure does work, if I pass %C3%9Cbermut instead of Übermut. However, I would of course like to avoid creating a translation table for all diacritics.
Can somebody figure out, what specific encoding problem is happening here?
After some more researching, I found out that what I need to urlEncode my string. That way, the letter Ü will be replaced with %C3%9C and it works for my purposes.
Applescript does not seem to support this natively, but one can use php to do the conversion. I found the method here: https://discussions.apple.com/message/9801376#9801376
So, in my case I used it like this:
set keyword to item 1 of arguments
set encodedKeyword to do shell script "php -r 'echo trim(urlencode(" & "\"" & keyword & "" & "\"));'"
do shell script "curl https://www.myUrl.com/" & encodedKeyword & ".html > targetFile"
This way, it works for me.
In case there is a better way - maybe something that works in Applescript directly - feel free to post another answer, then I'll change the accepted answer.
I'm trying to replace all punctuation and the likes in some text with just a space. So I have the line
text = "—Bonne chance Harry murmura t il »"
How can I remove the dash and the dash and »? I tried
text.gsub( /»|—/, ' ')
which gives an error, not surprisingly. I'm new to ruby and just trying to get a hang of things by writing a script to pull all the words out of a chapter of a book. I figure I'd just remove the punctuation and symbols and just use text.split. Any help would be appreciated. I couldn't find much
It turns out the problem had to do with the utf-8 encoding. Adding
# encoding: utf-8
solved my issues and what #Andrewlton said works great
This should properly substitute in the way you were trying to do it; just add brackets and remove the pipe:
text.gsub(/[»—]/, ' ')
The standard punctuation regexp also works:
text.gsub(/\p{P}/, ' ')
You should be able to use regexp pretty universally, coming from whatever language you know. Hope this helps!
I have problems with command 'load'.
For example my script is something like this:
set xlabel ‘blabla’
But when i try to load this, I get:
load '/Users/.../gnuplot.txt'
^
"/Users/.../gnuplot.txt", line 1: invalid character ?
I figured out that adding "reset" before the whole script change the error message:
set xlabel ‘blabla’
^
"/Users/.../gnuplot.txt", line 2: invalid character ?
But when I write everithing into the terminal by myself, I get no errors...
Any idea how to fix it??
Thanks
You are using the wrong quotation marks (Left and Right single quotation marks, codepoints U+2018 and U+2019).
You must use ASCII single or double quotation marks, either ' (0x27) or " (0x22).
Try putting this line before your load command
set encoding utf8
The invalid character smacks of using the wrong character set.
I tried to create a package using some functions and scripts I created (using X11 on a Mac). While R CMD check was doing its work, it encountered a problem as follows:
temp = trim(unlist(strsplit(lp.add(ranefterms[[i]]),
+ "\+")))
Error: '\+' is an unrecognized escape in character string starting "\+"
The oddest thing, however, is that my function actually does NOT have "\ +". Instead, it has "\ \ +" (see below). So I don't know why "\ \ +" is recognized as "\ +".
for(i in 1:n)
temp = trim(unlist(strsplit(lp.add(ranefterms[[i]]), '\\+')))
To dig a little further, I looked at the packageName-Ex.R file in the Rcheck folder. As it turned out, all the "\ \"s have been changed to "\" in the checking process (e.g., the double slashes I need for functions such as strsplit() and grepl())
I wonder what may have been the cause of it. Sorry that I can't come up with a reproducible example...
The offending code comes from the Examples section of one of your help files (which is why it ends up in packageName-Ex.R). To fix it, just escape each of the backslashes in the Examples sections of your *.Rd documentation files with a second backslash. (So, type \\to get \ in the processed help file, and type \\\\ to get \\.)
Unless it's escaped, \ is interpreted as a special character that identifies sectioning and mark-up macros (i.e. commands like \author, \description, \bold, and \ldots). Quoting from Duncan Murdoch's Parsing Rd files (the official manual for this topic):
The backslash \ is used as an escape character: \, \%, { and }
remove the special meaning of the second character.
As an example of what this looks like in practice, here is part of $R_SOURCE_HOME/src/library/base/man/grep.Rd, which is processed to create the help file you see when you type ?grep or ?gsub.
## capitalizing
txt <- "a test of capitalizing"
gsub("(\\\\w)(\\\\w*)", "\\\\U\\\\1\\\\L\\\\2", txt, perl=TRUE)
gsub("\\\\b(\\\\w)", "\\\\U\\\\1", txt, perl=TRUE)
In the processed help file, it looks like this:
## capitalizing
txt <- "a test of capitalizing"
gsub("(\\w)(\\w*)", "\\U\\1\\L\\2", txt, perl=TRUE)
gsub("\\b(\\w)", "\\U\\1", txt, perl=TRUE)