# Content negotiation bibtex url field

**URL:** <https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252>\
**Category:** Crossref Services\
**Tags:** content\_negotiation, bibtex\
**Created:** [2 December 2021 22:45 UTC](https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252 "2021-12-02T22:45:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sckott](https://sea2.discourse-cdn.com/flex020/user_avatar/community.crossref.org/sckott/32/61_2.png) [@sckott](https://community.crossref.org/u/sckott)\
**Post date:** [2 December 2021 22:45 UTC](https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252/1 "2021-12-02T22:45:10Z")

</div>

A user of habanero opened an issue recently

> <https://github.com/sckott/habanero/issues/99>
>
> With Python 3.6.8 and habanero 0.7.4, the \`\`\`/\`\`\` in the DOI-part of the field \`…\`\`url\`\`\` is replaced by \`\`\`%2F\`\`\`, e.g.
> the bibtex entry returned by \`\`\`www.doi2bib.org\`\`\` for the DOI \`\`\`10.1021/acs.jpcc.0c05161\`\`\` has the element
> 
> url = {https://doi.org/10.1021/acs.jpcc.0c05161}
> 
> However, when I run
> 
> bibtex\_string = habanero.cn.content\_negotiation(ids = doi)
> 
> with that DOI, the string I obtain contains
> 
> url = {https://doi.org/10.1021%2Facs.jpcc.0c05161}
> 
> Is this supposed to happen?

```auto
curl -L -H "Accept: application/x-bibtex" "https://doi.org/10.1021/acs.jpcc.0c05161"

```

gives

```auto
@article{Shao_2020,
	doi = {10.1021/acs.jpcc.0c05161},
	url = {https://doi.org/10.1021%2Facs.jpcc.0c05161},
	year = 2020,
	month = {oct},
	publisher = {American Chemical Society ({ACS})},
	volume = {124},
	number = {43},
	pages = {23479--23489},
	author = {Jingjing Shao and Vincent Pohl and Lukas Eugen Marsoner Steinkasserer and Beate Paulus and Jean Christophe Tremblay},
	title = {Electronic Current Mapping of Transport through Defective Zigzag Graphene Nanoribbons},
	journal = {The Journal of Physical Chemistry C}

```

The `url` field in the result has the slash after the DOI prefix URL encoded as `%2F` instead of `/`. I’ve checked a handful of other DOIs with the same result. The URL seems to be fine in other formats.

One can easily fix on the client side, e.g., in Python

```python
from habanero import cn
bibtex_string = cn.content_negotiation(ids='10.1021/acs.jpcc.0c05161')
from urllib.parse import unquote
unquote(bibtex_string)

```

But, it’s ideal if it can be fixed wherever the code is for serializing to bibtex format

---

<div class="post-metadata">

**Author:** ![Robbiefort](https://avatars.discourse-cdn.com/v4/letter/r/cc9497/32.png) [@Robbiefort](https://community.crossref.org/u/Robbiefort)\
**Post date:** [3 December 2021 06:12 UTC](https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252/2 "2021-12-03T06:12:51Z")

</div>

code error at run time […](https://www.mypascoconnect.info/)

---

<div class="post-metadata">

**Author:** ![Shayn](https://sea2.discourse-cdn.com/flex020/user_avatar/community.crossref.org/shayn/32/57_2.png) [@Shayn](https://community.crossref.org/u/Shayn)\
**Post date:** [4 December 2021 00:58 UTC](https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252/3 "2021-12-04T00:58:22Z")

</div>

Thanks for letting us know. I’ve reported this issue to our tech team as well.

> **[URL in bibtex output via Content Negotiation and REST API unnecessarily...](https://gitlab.com/crossref/issues/-/issues/1612)**
>
> Background This came in through the Community Forum https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252 And originally posted as an...

---

<div class="post-metadata">

**Author:** ![sckott](https://sea2.discourse-cdn.com/flex020/user_avatar/community.crossref.org/sckott/32/61_2.png) [@sckott](https://community.crossref.org/u/sckott)\
**Post date:** [4 December 2021 01:03 UTC](https://community.crossref.org/t/content-negotiation-bibtex-url-field/2252/4 "2021-12-04T01:03:41Z")

</div>

Thanks very much for the response
