On 02.11.2014, at 14:59, stepharo <stepharo@free.fr> wrote:
On 2/11/14 12:37, Max Leske wrote: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?
In fact I get the stream contents but the regex does not match.
I suspect a problem with the encodings of the file. Do you have an idea? Stef