[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Stripping 'charset=' from po files [the sequal]

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-05-13 20:49:37 CEST

Erik Huelsmann wrote:

>In order to prevent charset conversion by 'smart' gettext implementations
>our build system has to strip out the the 'charset=UTF-8' string in the
>administrative section of po files. The Makefile based system currently
>does this by ripping out the entire 'Content-Type' line using 'sed'.
>
>
>The Windows (python based) build system does not provide sed. To work
>around that I wrote the general python based po parser included below. A
>separate script does the real stripping. This also provides the (cleaner)
>solution to only examen the admin section.
>
>
>There are several questions to be answered before proceding:
>
>1) We don't want to use the same script for the Makefile build (adding a new
>dependency), do we?
>
>
Using sed in the Makefile is fine.

>2)
> a) Do we want the po parser in the Subversion repository?
> b) If so: where?
>
>
>3) Do you have any comments to either script? (the strip charset script has
>to be extended to include plural support before this code can be committed)
>
>
I think this parser is overkill. How about something like this (just
typing, not testing):

    podir = 'subversion/po'
    filtered_podir = ...
    for file in os.listdir(podir):
      if file[-3:] != '.po':
        continue
      _filter_charser(podir, file), filtered_podir)

    def _filter_charser(source, file, target):
      f = open(os.path.join(source, file), 'rb')
      content = f.read()
      f.close()
      f = open(os.path.join(target, file), 'wb')
      f.write(string.replace(content, 'Content-Type: ....', ''))
      f.close()

I don't think we need anything more complicated than this sed-like
replacement in the Windows build.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 13 20:52:20 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.