vim text replacement : :%s/é/&&eacute/g foreign language - vim

I have a text with multiple french character: I'm trying to replace all the occurrences for an HTML code
example été to get => été
right now I'm having either error or a weird text
:%s/é/&é/g => this gives me a ééeacute;tééeacute;
:%s/é/&é/g => this gives me a éeacute;téeacute;
:%s/é//é/g => this gives me an error Trailling character

In the replacement part, & is special, it represents the whole match:
J'ai mangé du paté de campagne.
:s/é/&´/g
J'ai mangéacute; du patéeacute; de campagne.
Escape it to obtain the desired &:
:s/é/\´/g
J'ai mang´ du paté de campagne.

Related

Unable to return text between two different strings

I am trying to use Excel to get text between specific text
ALERT [ NewStrat ]\n\nSpanish La Liga / Celta Vigo v Valladolid\nFeb
28 at 13:00\n\nMatch Odds: 2.64 / 5.7 / 2.22 ( £280,985 )\nAt
kick-off: 1.95 / 4.6 / 3.6\n\nUnder/Over 1.5: 1.37 / 3.55 ( £21,920
)\nAt kick-off: 3.45 / 1.4\n\nUnder/Over 2.5: 1.09 / 11 ( £52,397
)\nAt kick-off: 1.81 / 2.2\n\nCorrect Score: ( £18,423 )\n\nScore: 0
In the Example above I would like to get the teams playing (Celta Vigo v Valladolid).
I use the following but it returns a blank cell and im sure its due to this part of the string
SEARCH("\n"
I have to seach by \n as this is the only part of the text that will be the same across other text
=IFERROR(MID($C$2,SEARCH("Spanish La Liga",$C$2)+LEN("Spanish La Liga"),SEARCH("\n",$C$2)-SEARCH("Spanish La Liga",$C$2)-LEN("Spanish La Liga")), "")
This can be done with a shorter/less verbose formula, but the nice thing to do here is to use the delimiters in the text for what they were meant to be, delimiters of some sort. \n was probably used as a newline character in the source of this text, but we can now utilize FILTERXML() to split your input again on this pattern:
=MID(FILTERXML("<t><s>"&SUBSTITUTE(A1,"\n","</s><s>")&"</s></t>","//s[starts-with(., 'Spanish La Liga')]"),19,LEN(A1))
I used A1 as a placeholder for whichever cell you were refering to. The way it works is that we used SUBSTITUTE() to create a a valid XML-string full of start/end-tags. The xpath expression then looks for the element that starts with "Spanish La Liga". A simple MID() function then takes care of the string operation to only report the relevant part.

Bing web search api advanced query

I have a question about bing web search api :
I want use a filter in my query for :
articles + documents
articles only
documents only
Articles are html pages
Documents are pdf, doc, docx, ... with /lfy/documents/ path
I have tried with ext parameter but he seems not work with ext:html
I try filtering by path (contains "/documents" for documents, don't contains /documents for web pages)
1/ Filter including site with syntax error
q=site:www.msa.fr/lfy/ Barèmes des cotisations sur sallaires
-> return results :-)
Altered query is : "alteredQuery": "barèmes des cotisations sur salaires"
sallaires become salaires : ok !
2/ Filter including site and excluding sub site with syntax error
q=site:www.msa.fr/lfy/ NOT site:www.msa.fr/lfy/documents Barèmes des cotisations sur sallaires
-> return no results
Adding NOT site: break the syntax correction
3/ Filter including site and excluding sub site without syntax error
q=site:www.msa.fr/lfy/ NOT site:www.msa.fr/lfy/documents Barèmes des cotisations sur salaires
-> return results
Adding "NOT site:xxx" break the syntax correction
Note : i use
responseFilter=Webpages
mkt=fr-fr
safesearch=Moderate
Every one have a solution ?
Thanks for your help.
Florian.
You need to use "-" instead of "NOT". The below should work:
q=Barèmes des cotisations sur sallaires site:www.msa.fr/lfy/
q=Barèmes des cotisations sur sallaires site:www.msa.fr/lfy/ -site:www.msa.fr/lfy/documents

Nodejs encode string ISO8859-1

I've been looking for an answer for some days.
I am receiving data per post from a form containing special characters (accents)
eg : Está é uma sala de teste
App Node: Est%E1+%E9+uma+sala+de+teste
What is the correct way in nodejs, to decode the string to save to in my database?
I did it that way. But I'm sure it's not the right way
decode string with accents
My apologize if this is a duplicate issue, but not that I found myself able to resolve the issue
thank you any advanced.
You can use a module like iconv-urlencode for that:
const conv = require('iconv-urlencode');
let input = 'Est%E1+%E9+uma+sala+de+teste';
console.log( conv.decode(input, 'latin-1') );
// Está é uma sala de teste

Escape character for parameter in function of EL

I have this element in my page:
<p:panel header="Advies van de dienst aangemaakt op: #{of:formatDate(advies.aangemaaktOp, 'dd/MM/yyyy HHumm')}">
It renders to:
Advies van de dienst aangemaakt op: 30/03/2016 14357
It should be:
Advies van de dienst aangemaakt op: 30/03/2016 14u57
How do I achieve this? I know I should find a way to escape the 'u' character but since I am in a parameter of a function in an expression of EL, I cannot find a solution to do it.
Suggestion on the internet which doesn't work is using the tick '.
Tried also to escape with backslash but also no luck
The solution is 'dd/MM/yyyy HH\'u\'mm'. I had to escape the tick itself.
Complete element:
<p:panel header="Advies van de dienst aangemaakt op: #{of:formatDate(advies.aangemaaktOp, 'dd/MM/yyyy HH\'u\'mm')}">

What encoding is this and how can I decode it?

I've got an old project file with translations to Portuguese where special characters are broken:
error.text.required=\u00C9 necess\u00E1rio o texto.
error.categoryid.required=\u00C9 necess\u00E1ria a categoria.
error.email.required=\u00C9 necess\u00E1rio o e-mail.
error.email.invalid=O e-mail \u00E9 inv\u00E1lido.
error.fuel.invalid=\u00C9 necess\u00E1rio o tipo de combust\u00EDvel.
error.regdate.invalid=\u00C9 necess\u00E1rio ano de fabrica\u00E7\u00E3o.
error.mileage.invalid=\u00C9 necess\u00E1ria escolher a quilometragem.
error.color.invalid=\u00C9 necess\u00E1ria a cor.
Can you tell me how to decode the file to use the common Portuguese letters?
Thanks
The "\u" is prefix for unicode. You can use the strings "as is", and you'll have diacritics showing in the output. A python code would be something like:
print u"\u00C9 necess\u00E1rio o texto."
which outputs:
É necessário o texto.
Otherwise, you need to convert them in their ASCII equivalents. You can do a simple find/replace. I ended up writing a function like that for converting Romanian diacritics a while ago, but I had dynamic strings coming in...
Smell to me like this is unicode?
\u = prefix unicode character
00E1 = hex code for the 2 byte number of the unicode.
Not sure what the format is - I would ask the sencer, but i would try this approach to decode it.
found it ;)
http://www.fileformat.info/info/unicode/char/20/index.htm
Look at the tables with source code. This can be a C++ source file. This is the way you give unicodde characters in source.

Resources