Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
498 views
in Q2A Core by
recategorized
Not working UTF-8
"ş,ü,ğ,ç,ö,ı,"

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<url>

<loc>

http://www.---.com/5/disk-g%C3%B6z%C3%BCkm%C3%BCyor-b%C3%B6l%C3%BCm

</loc>





2 Answers

+1 vote
by
edited by

#!/usr/bin/env python
# -*- coding: utf8 -*-

def unicode_karakterlere_cevir(metin):
    liste = {"%C3%B6": "ö",
             "%C5%9F": 'ş',
             "%C3%BC": 'ü',
             "%C3%A7": 'ç',
             "%C4%B1": 'ı',
             "%C4%9F": 'ğ',
             "%C3%A9": 'é',
             "%24" : '$'}
    metin = metin.encode('utf-8')
    for karakter in liste:
        metin = metin.replace(karakter, liste[karakter])
    return metin


kutuk = open("sitemap.xml", 'r')
kutuk2 = open("sitemap_utf.xml", 'w')

satirlar = kutuk.readlines()

for satir in satirlar:
    kutuk2.write(unicode_karakterlere_cevir(satir))
    kutuk2.write('\n')

I haven't tested but this small python script should work.

Also have a look at my answer in other thread.

0 votes
by

Also you may use this small python program to generate sitemap on the fly.

small python crawler which generates sitemap

It takes some time but I generated my sitemap using this small program. Just run as:

$ python orumcek.py

Turkish :

Burada ilk örümcek sadece ana siteyi geziyor. Gezmesini istediğimiz sayfalara priority öncelik ile belirtebiliyoruz.

$ python orumcek.py

şeklinde çalıştırabilirsiniz. Dikkat ederseniz hem ana sayfada hem de sorular sayfasında 199'ar sayfa geziyor. İhtiyaca göre bunları değiştirebilirsiniz.

...