I need to remove special characters like \r,\n in informatica using mapping parameter. When I am giving \r, \n in mapping parameter it is not getting populated correctly for multiple values
I do not think they can be passed using parameter like \n,\r.
You can use chr() functionality and use ASCII values.
For line feed,pass 10 in parameter. And use it like below in expression transformation -
REPLACESTR(1,STRING_PORT,chr($$Param1),'')
For carriage return, pass 13.
Related
I'm trying to modify a QString. The Qstring that I'm trying to modify is
"\002"
However when I try to modify it, the string either gets entirely deleted or shows no change.
I've tried
String.split("\"");
String.remove("\"");
String.remove(QChar('\'');
for some reason Qt requires that I add an extra " or ' in order to compile and not produce errors
What I currently have is this
string = pointer->data.info.get_type();
which according to the debugger returns "\002"
string = string.remove(QChar('\''));
the remove functionality does nothing afterwards.
I'm expecting to remove the \ from the string, but either it gets entirely deleted or nothing happens. What could be the problem and how do I modify the Qstring to just be the numerical values?
You're currently asking Qt to remove " from your string, not \. To remove \, you'll have to escape it, just like you escaped ", i.e. remove("\\").
First of all your string "\002" do not contain any slash, quotes or apostrophes.
Read about C++ string literals. This is escape sequence.
Note \nnn represents arbitrary octal value!
So your literal contains only one character of value decimal value 2! This is ASCII spatial code meaning: STX (start of text)
As a result this code:
String.split("\"");
String.remove("\"");
String.remove(QChar('\'');
won't split or anything since this string do not contain quote characters or apostrophe. It also do not tries split or remove slash character, since again this is an escape sequence, but different kind.
Now remember that debugger shows you this unprintable characters in escaped form to show you actual content. In live application user will see nothing or some strange glyph.
We have a requirement wherein we need to replace or remove '�' character (which is an unrecognizable, undefined character) present in our source. While running my workflow it runs successfully but when i check the records in target they are not committed. I get the following error in Informatica
Error executing query for record 37: 6706: The string contains an untranslatable character.
I tried functions like replace_chr, reg_replace, replace_str etc., but none seems to be working. Kindly advise on how to get rid of this. Any reply is greatly appreciated.
You need to use in your schema definitions charset=> utf8-unidode-ci
but now you can do:
UPDATE tablename
SET columnToCheck = REPLACE(CONVERT(columnToCheck USING ascii), '?', '')
WHERE ...
or
update tablename
set columnToCheck = replace(columnToCheck , char(146), '');
Replace NonASCII Characters in MYSQL
You can replace the special characters in an expression transformation.
REPLACESTR(1,Column_Name,'?',NULL)
REPLACESTR - Function
1 - Position
Column_Name - Column name which has a special character
? - Special character
NULL - Replacing character
You need to fetch rows with the appropriate character set defined on your connection. What is the connection you're using, ODBC or native? What's the DB?
Special characters are a challenge and having checked the informatica network I can see there is a kludge involving replace_str setting first a variable to the string with all non special characters first and then using the resulting variable in a replace_str so that the final value has only the allowed characters https://network.informatica.com/thread/20642 (awesome workaround by nico so long as you can positively identify every character that should be allowed) ...
As an alternate kludge I would also attempt something using an xml transformation somewhere within the mapping as informatica conveniently converts special characters to encoded (decimal or hex I cant remember) values... so long as you can live with these encoded values appearing in your target text you should be fine ( and build some extra space into your strings to accommodate any bloatage from the extra characters
I need to decode a string coming from json. Special characters are encoded as hex unicode (e.g. the apostrophe is /u0027).
I'm trying to accomplish this with these expression:
regexprep('Can/u0027t add the category','/u(\d{4})',native2unicode(hex2dec(strrep('$1','/u',''))))
but I get the following error
Error using hex2dec (line 38)
Input string found with characters other than 0-9, a-f, or A-F.
because hex2dec receives '$1' as value and not the result of strrep('$1','/u','').
If I try
regexprep('Can/u0027t add the category','/u(\d{4})',strrep('$1','/u',''))
I get, correctly, 'Can0027t add the category'. If I try with
regexprep('Can/u0027t add the category','/u(\d{4})',native2unicode(hex2dec(strrep('/u0027','/u',''))))
I get the right result (but with a fixed decoding, obviously).
I don't understand why the result of strrep is not the input argument of hex2dec.
You're tricking yourself with the debug. The $1 expansion in the replacement string operates on the string itself, as seen by regexprep. It is not expanded by the MATLAB parser before calling any functions, which will just see the string '$1'. If the result of those functions contains a $1, it will get passed into regexprep and expanded. So, for example, your test case with the bare strrep replaces nothing (since its input is the string '$1'), and passes the bare $1 string right back into regexprep.
You have two issues. One is easy: you don't need strrep at all, since the parentheses mark just the hex digits as the token. $1 expands with no /u. Test it:
regexprep('Can/u0027t add the category','/u(\d{4})','$1')
results in 'Can0027t add the category'.
Now for the harder one. As previously noted, you can't call normal functions on the $1 and have them do anything. However, MATLAB provides a special regexp syntax to call functions from inside the replacement string. Here is the documentation:
http://www.mathworks.com/help/matlab/matlab_prog/dynamic-regular-expressions.html
In summary, ${cmd($1)} expands to calling the MATLAB function cmd on the replacement token to generate the replacement string. So putting it all together:
regexprep('Can/u0027t add the category', '/u(\d{4})', '${native2unicode(hex2dec($1))}')
ans = Can't add the category
I'm trying to convert a bunch of .textile files into their equivalent .markdown files.
I would like a vim search/replace command to replace all h1., h2., h3., etc. patterns with the associated number of # characters. So, h1. would become #, h2. would be come ## and so forth.
I think what I want to use is the \=repeat command, but I'm a bit lost as to what arguments to pass it.
Here is what I have so far. It replaces the correct matches, but it just deletes them and gives me errors:
:1,$s/h\d./\=repeat('#',submatch(0))
What are the proper arguments to pass to the \=repeat command?
this line may help you:
%s/\vh(\d)\./\=repeat('#',submatch(1))
you used submatch(0), it was the whole matched string : h and number and any char (here you had another problem, you should escape the period ), so it won't do what you were expecting.
$value->location->latitude and $value->location->longitude output respectively something like 41,90693866 and 12,414128943. I have a link which points to
href="http://maps.google.com/maps?q='.htmlentities($value->location->latitude).',+'.htmlentities($value->location->longitude).'"
Problem is Google Maps accepts values like 41.90693866 (notice dot instead of comma), it doesn't work with 41,90693866, 12,414128943 input (it does with 41.90693866, 12.414128943). How can I output latitude/longitude with comma instead of dot?
The json data that I see with the Instagram API uses periods and not commas with the lat/lng data. Are you sure something in your code is not transforming the formatting? Check your code for this.