On 01.11.2014, at 22:07, stepharo <stepharo@free.fr> wrote:
Hi guys
I'm doing a small variable expansion to relocate my webpage. I want to expand -base- into <base>http://sdmeta.gforge.inria.fr</base> Now it works when I test with some strings inside the image
trying "self new trying"
^ self sample copyWithRegex: '-BASE-' matchesReplacedWith: self baseString.
sample
^ '<?xml version="1.0" encoding="ISO-8859-1"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <link rel="stylesheet" href="stef.css"/> <head> -BASE- <title>Dr. Stéphane Ducasse</title> </head>'
baseString ^ '<base>http://sdmeta.gforge.inria.fr </base>'
self new trying results
'<?xml version="1.0" encoding="ISO-8859-1"?> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <link rel="stylesheet" href="stef.css"/> <head> <base>http://sdmeta.gforge.inria.fr </base> <title>Dr. Stéphane Ducasse</title> </head>'
and this is good.
Now when I work with a stream it does.
contentsOf: aFileSystemFile "self new contentsOf: (FileSystem workingDirectory / 'Books.html') " contents := aFileSystemFile readStream contents
tryingContents "self new tryings"
^ self sample copyWithRegex: '-BASE-' matchesReplacedWith: contents.
Whatâs the âwrongâ output you get here?
I suspect a problem with the encodings of the file. Do you have an idea?
Stef