FAQ
Okay where to start..

I'm reading a bunch of filenames from disk, utf-8 filenames
inserting them in MongoDB via mgo
inserted document fields are stored with the actual utf-8 characters
e.g. { "name": "Anstoss.Stö.TRP+GRB.zip"}
Now in a pagehandler I'm reading those files from MongoDB via mgo
(Collection.Find(nil).Sort("name").All(&files))

type File struct {
Name string
}

In the template I have
{{ range .Files }}
<a href="/files/{{.Name}}">{{.Name}}</a>
{{end}}

The output however is

<a
href="/files/a/Anstoss.St%c3%83%c2%b6.TRP+GRB.zip">Anstoss.St�%83¶.TRP+GRB.zip</a>
<a href="/files/a/Anstoss.St%c3%b6.TRP+GRB.zip">Anstoss.Stö.TRP+GRB.zip</a>

but there is only 1 document
{
     "_id" : "e90644b9-b348-4955-a661-b78001d053ec",
     "name" : "Anstoss.Stö.TRP+GRB.zip",
     "path" : "a/Anstoss.Stö.TRP+GRB.zip",
     "size" : NumberLong(27584),
     "sha512" :
"8aaea2541da0ceef5e8dfc42573aeb86c8b08cd066c8d8691b715d0b4210a1512566042fff00e5a862edd0fea703acd1fb242490fbf5cd595eb43c5f548ddbde"
}

Why is this happening?
How can I prevent this?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Darko Luketic at Sep 7, 2014 at 2:14 pm
    After inspecting the data that I'm getting through mgo I see duplicate
    entries.
    286 Anstoss.St�%83¶.TRP+GRB.zip
    287 Anstoss.Stö.TRP+GRB.zip

    for k,v := range files {
    fmt.Println(k, v.Name)
    }

    So false alarm, not a html/template issue
    On Sunday, September 7, 2014 3:58:07 PM UTC+2, Darko Luketic wrote:

    Okay where to start..

    I'm reading a bunch of filenames from disk, utf-8 filenames
    inserting them in MongoDB via mgo
    inserted document fields are stored with the actual utf-8 characters
    e.g. { "name": "Anstoss.Stö.TRP+GRB.zip"}
    Now in a pagehandler I'm reading those files from MongoDB via mgo
    (Collection.Find(nil).Sort("name").All(&files))

    type File struct {
    Name string
    }

    In the template I have
    {{ range .Files }}
    <a href="/files/{{.Name}}">{{.Name}}</a>
    {{end}}

    The output however is

    <a
    href="/files/a/Anstoss.St%c3%83%c2%b6.TRP+GRB.zip">Anstoss.St�%83¶.TRP+GRB.zip</a>
    <a href="/files/a/Anstoss.St%c3%b6.TRP+GRB.zip">Anstoss.Stö.TRP+GRB.zip</a>

    but there is only 1 document
    {
    "_id" : "e90644b9-b348-4955-a661-b78001d053ec",
    "name" : "Anstoss.Stö.TRP+GRB.zip",
    "path" : "a/Anstoss.Stö.TRP+GRB.zip",
    "size" : NumberLong(27584),
    "sha512" :
    "8aaea2541da0ceef5e8dfc42573aeb86c8b08cd066c8d8691b715d0b4210a1512566042fff00e5a862edd0fea703acd1fb242490fbf5cd595eb43c5f548ddbde"
    }

    Why is this happening?
    How can I prevent this?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Darko Luketic at Sep 7, 2014 at 2:19 pm
    And again false alarm, those actually were 2 documents.
    So.. close, ignore, delete. My bad.
    On Sunday, September 7, 2014 3:58:07 PM UTC+2, Darko Luketic wrote:

    Okay where to start..

    I'm reading a bunch of filenames from disk, utf-8 filenames
    inserting them in MongoDB via mgo
    inserted document fields are stored with the actual utf-8 characters
    e.g. { "name": "Anstoss.Stö.TRP+GRB.zip"}
    Now in a pagehandler I'm reading those files from MongoDB via mgo
    (Collection.Find(nil).Sort("name").All(&files))

    type File struct {
    Name string
    }

    In the template I have
    {{ range .Files }}
    <a href="/files/{{.Name}}">{{.Name}}</a>
    {{end}}

    The output however is

    <a
    href="/files/a/Anstoss.St%c3%83%c2%b6.TRP+GRB.zip">Anstoss.St�%83¶.TRP+GRB.zip</a>
    <a href="/files/a/Anstoss.St%c3%b6.TRP+GRB.zip">Anstoss.Stö.TRP+GRB.zip</a>

    but there is only 1 document
    {
    "_id" : "e90644b9-b348-4955-a661-b78001d053ec",
    "name" : "Anstoss.Stö.TRP+GRB.zip",
    "path" : "a/Anstoss.Stö.TRP+GRB.zip",
    "size" : NumberLong(27584),
    "sha512" :
    "8aaea2541da0ceef5e8dfc42573aeb86c8b08cd066c8d8691b715d0b4210a1512566042fff00e5a862edd0fea703acd1fb242490fbf5cd595eb43c5f548ddbde"
    }

    Why is this happening?
    How can I prevent this?
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 7, '14 at 1:58p
activeSep 7, '14 at 2:19p
posts3
users1
websitegolang.org

1 user in discussion

Darko Luketic: 3 posts

People

Translate

site design / logo © 2022 Grokbase