Peter Boyer

Greenhorn
+ Follow
since May 03, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Peter Boyer

Hello everyone,

New request
I would like open a file and replace day's data by day's data +1.
For example, today we are the 14th, May 2019 and I can have : 2019-05-14 but I would like 2019-05-15

Thank you in advance for your help
1 week ago

Peter Boyer wrote:

Paul Clapham wrote:I assume that when you say "doesn't work" that you actually mean that the characters in question are not removed from the text.

Anyway I'm surprised that the "@" character is one of those so-called "special" characters which isn't handled correctly. That means it's not a Unicode or character set issue because that's an ordinary ASCII character.

However since I'm no Jython (or Python) expert I can't suggest anything more.



Ohh you are right, it was a mistake, it is ok for @.
I wanted write that it does not work for à
And indeed when i wrote "does not work", that means that the characters in question are not removed from the text



It is OK :)
FYI, we have to add : s = unicode( t, "utf-8" )
1 week ago

Paul Clapham wrote:I assume that when you say "doesn't work" that you actually mean that the characters in question are not removed from the text.

Anyway I'm surprised that the "@" character is one of those so-called "special" characters which isn't handled correctly. That means it's not a Unicode or character set issue because that's an ordinary ASCII character.

However since I'm no Jython (or Python) expert I can't suggest anything more.



Ohh you are right, it was a mistake, it is ok for @.
I wanted write that it does not work for à
And indeed when i wrote "does not work", that means that the characters in question are not removed from the text
2 weeks ago

Rob Spoor wrote:Which Python version are you using? If you're using Python 2, strings are not automatically Unicode. Try using s = s.replace(u'ç', '') - the u tells Python that it's a Unicode string.



Hi,
Thank you for your response.
I use Jython and not Pyhton from the ODI software, maybe you know?

Nevertheless, I tried s = s.replace(u'ç', '') but without sucess
2 weeks ago
Hello everyone,

I start in Jython and I would like open a file and replace special characters

Here my code :
s = open("C:\JYTHON\TEST.xml").read()
s = s.replace('&', '')
s = s.replace('è', '')
s = s.replace('é', '')
s = s.replace('*', '')
s = s.replace('%', '')
s = s.replace('@', '')
s = s.replace('ç', '')
s = s.replace('à', '')
s = s.replace('#', '')
s = s.replace('«', '')
s = s.replace('»', '')
f = open("C:\JYTHON\TEST.xml", 'w')
f.write(s)
f.close()

It works for : & * %  #
It does not work for : é è ç à << >>


In addition, my list may not be exhaustive: ê Ê ...

Thank you in advance for your help
3 weeks ago