@@ -16,7 +16,9 @@ window["quarto-listing-loaded"] = () => {
1616 if ( hash ) {
1717 // If there is a category, switch to that
1818 if ( hash . category ) {
19- activateCategory ( hash . category ) ;
19+ // category hash are URI encoded so we need to decode it before processing
20+ // so that we can match it with the category element processed in JS
21+ activateCategory ( decodeURIComponent ( hash . category ) ) ;
2022 }
2123 // Paginate a specific listing
2224 const listingIds = Object . keys ( window [ "quarto-listings" ] ) ;
@@ -59,7 +61,10 @@ window.document.addEventListener("DOMContentLoaded", function (_event) {
5961 ) ;
6062
6163 for ( const categoryEl of categoryEls ) {
62- const category = atob ( categoryEl . getAttribute ( "data-category" ) ) ;
64+ // category needs to support non ASCII characters
65+ const category = decodeURIComponent (
66+ atob ( categoryEl . getAttribute ( "data-category" ) )
67+ ) ;
6368 categoryEl . onclick = ( ) => {
6469 activateCategory ( category ) ;
6570 setCategoryHash ( category ) ;
@@ -209,7 +214,9 @@ function activateCategory(category) {
209214
210215 // Activate this category
211216 const categoryEl = window . document . querySelector (
212- `.quarto-listing-category .category[data-category='${ btoa ( category ) } ']`
217+ `.quarto-listing-category .category[data-category='${ btoa (
218+ encodeURIComponent ( category )
219+ ) } ']`
213220 ) ;
214221 if ( categoryEl ) {
215222 categoryEl . classList . add ( "active" ) ;
@@ -232,7 +239,9 @@ function filterListingCategory(category) {
232239 list . filter ( function ( item ) {
233240 const itemValues = item . values ( ) ;
234241 if ( itemValues . categories !== null ) {
235- const categories = atob ( itemValues . categories ) . split ( "," ) ;
242+ const categories = decodeURIComponent (
243+ atob ( itemValues . categories )
244+ ) . split ( "," ) ;
236245 return categories . includes ( category ) ;
237246 } else {
238247 return false ;
0 commit comments