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
Related
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
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')}">
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.
We are sending SMS to confirm cel number, but one of them arrived in a weird format, is like adding a "¿" before each character
The Log on Twillio says it was send as follows:
Direction -> Outgoing API
Status -> Delivered
Body -> Haz clic en el link miaguila://validate/7/G34DDR para tu número en Mi Aguila
But we got something like
¿H¿a¿z¿ ¿c¿l¿i¿c¿ ¿e¿n¿ ¿e¿l¿ ¿l¿i¿n¿k¿ ¿m¿i¿a¿g¿u¿i¿l¿a¿:¿/¿/¿v¿a¿l¿i¿d¿a¿t¿e¿/¿7¿/¿U¿0¿C¿X¿0¿I¿ ¿p¿a¿r¿a¿ ¿t¿u¿ ¿n¿?¿m¿e¿r¿o¿ ¿e¿n¿ M i A g u i l a
This is a screenshot of what we got
https://s3.amazonaws.com/maothers/unnamed.png
Thanks in advance
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.